This commit is contained in:
2020-10-27 00:08:07 +00:00
parent 043a62e89e
commit c0b791a997
2 changed files with 7 additions and 6 deletions

View File

@@ -58,7 +58,8 @@ namespace AyaNova.Api.Controllers
// AyaTypeId attachToObject = null;
ApiUploadProcessor.ApiUploadedFilesResult uploadFormData = null;
List<string> ImportResult=new List<string>();
List<string> ImportResult = new List<string>();
ImportResult.Add("Import results\n");
try
{
if (!MultipartRequestHelper.IsMultipartContentType(Request.ContentType))
@@ -104,7 +105,7 @@ namespace AyaNova.Api.Controllers
foreach (UploadedFileInfo a in uploadFormData.UploadedFiles)
{
JArray ja = JArray.Parse(System.IO.File.ReadAllText(a.InitialUploadedPathName));
ImportResult.AddRange(await ((IImportAbleObject)biz).ImportData(ja));
ImportResult.AddRange(await ((IImportAbleObject)biz).ImportData(ja));
}
}
}
@@ -119,8 +120,7 @@ namespace AyaNova.Api.Controllers
ApiUploadProcessor.DeleteTempUploadFile(uploadFormData);
}
//TODO: Return results of operation here
return Ok(ImportResult);
return Ok(ApiOkResponse.Response(ImportResult));
}

View File

@@ -9,7 +9,6 @@ using AyaNova.Models;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace AyaNova.Biz
{
@@ -344,14 +343,16 @@ namespace AyaNova.Biz
var res = await CreateAsync(w);
if (res == null)
{
ImportResult.Add($"{w.Name} - no {this.GetErrorsAsString()}");
ImportResult.Add($"{w.Name} - {this.GetErrorsAsString()}");
this.ClearErrors();
}
else
{
ImportResult.Add($"{w.Name} - ok");
}
}
return ImportResult;
}