This commit is contained in:
2020-06-25 18:02:25 +00:00
parent d52be28f0c
commit 74650ad83d
2 changed files with 5 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ using AyaNova.Biz;
using System; using System;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Linq;
using System.Linq; using System.Linq;
using AyaNova.Util; using AyaNova.Util;
@@ -402,10 +403,10 @@ namespace AyaNova.Api.Controllers
//deserialize each file and import //deserialize each file and import
foreach (UploadedFileInfo a in uploadFormData.UploadedFiles) foreach (UploadedFileInfo a in uploadFormData.UploadedFiles)
{ {
if (!await biz.ImportAsync(ImportJson)) JObject o = JObject.Parse(System.IO.File.ReadAllText(a.InitialUploadedPathName));
if (!await biz.ImportAsync(o))
{ {
//delete all the files temporarily uploaded and return bad request //delete all the files temporarily uploaded and return bad request
DeleteTempUploadFile(uploadFormData); DeleteTempUploadFile(uploadFormData);
return BadRequest(new ApiErrorResponse(biz.Errors)); return BadRequest(new ApiErrorResponse(biz.Errors));
} }

View File

@@ -129,6 +129,8 @@ namespace AyaNova.Biz
// //
internal async Task<bool> ImportAsync(JObject o) internal async Task<bool> ImportAsync(JObject o)
{ {
var v = o.Count;
// Translation dbObject = await ct.Translation.Include(z => z.TranslationItems).SingleOrDefaultAsync(z => z.Id == id); // Translation dbObject = await ct.Translation.Include(z => z.TranslationItems).SingleOrDefaultAsync(z => z.Id == id);
// if (dbObject == null) // if (dbObject == null)