This commit is contained in:
2020-10-26 23:48:21 +00:00
parent 1d9e778ced
commit 043a62e89e
3 changed files with 25 additions and 8 deletions

View File

@@ -43,7 +43,7 @@ namespace AyaNova.Api.Controllers
/// Upload and import file
/// Max 100mb total
/// </summary>
/// <returns>Accepted</returns>
/// <returns>Results</returns>
[Authorize]
[HttpPost("upload")]
[DisableFormValueModelBinding]
@@ -58,6 +58,7 @@ namespace AyaNova.Api.Controllers
// AyaTypeId attachToObject = null;
ApiUploadProcessor.ApiUploadedFilesResult uploadFormData = null;
List<string> ImportResult=new List<string>();
try
{
if (!MultipartRequestHelper.IsMultipartContentType(Request.ContentType))
@@ -103,7 +104,7 @@ namespace AyaNova.Api.Controllers
foreach (UploadedFileInfo a in uploadFormData.UploadedFiles)
{
JArray ja = JArray.Parse(System.IO.File.ReadAllText(a.InitialUploadedPathName));
await ((IImportAbleObject)biz).ImportData(ja);
ImportResult.AddRange(await ((IImportAbleObject)biz).ImportData(ja));
}
}
}
@@ -119,7 +120,7 @@ namespace AyaNova.Api.Controllers
}
//TODO: Return results of operation here
return Accepted();
return Ok(ImportResult);
}