This commit is contained in:
@@ -399,7 +399,7 @@ namespace AyaNova.Api.Controllers
|
||||
//We have our files now can parse and insert into db
|
||||
if (uploadFormData.UploadedFiles.Count > 0)
|
||||
{
|
||||
//deserialize the file
|
||||
//deserialize each file and import
|
||||
foreach (UploadedFileInfo a in uploadFormData.UploadedFiles)
|
||||
{
|
||||
if (!await biz.ImportAsync(ImportJson))
|
||||
@@ -409,14 +409,6 @@ namespace AyaNova.Api.Controllers
|
||||
DeleteTempUploadFile(uploadFormData);
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
|
||||
//import into the db
|
||||
|
||||
|
||||
|
||||
var v = await FileUtil.StoreFileAttachmentAsync(a.InitialUploadedPathName, a.MimeType, a.OriginalFileName, theDate, attachToObject, Notes, ct);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ using AyaNova.Util;
|
||||
using AyaNova.Api.ControllerHelpers;
|
||||
using AyaNova.Models;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace AyaNova.Biz
|
||||
{
|
||||
@@ -121,6 +124,51 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//IMPORT
|
||||
//
|
||||
internal async Task<bool> ImportAsync(JObject o)
|
||||
{
|
||||
// Translation dbObject = await ct.Translation.Include(z => z.TranslationItems).SingleOrDefaultAsync(z => z.Id == id);
|
||||
|
||||
// if (dbObject == null)
|
||||
// {
|
||||
// AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||
// return null;
|
||||
// }
|
||||
// Translation newObject = new Translation();
|
||||
// //CopyObject.Copy(dbObject, newObject, "Id, Salt, Login, Password, CurrentAuthToken, DlKey, DlKeyExpire, Wiki, Serial");
|
||||
// string newUniqueName = string.Empty;
|
||||
// bool NotUnique = true;
|
||||
// long l = 1;
|
||||
// do
|
||||
// {
|
||||
// newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
|
||||
// NotUnique = await ct.Translation.AnyAsync(z => z.Name == newUniqueName);
|
||||
// } while (NotUnique);
|
||||
// newObject.Name = newUniqueName;
|
||||
|
||||
// newObject.Stock = false;
|
||||
// newObject.CjkIndex = false;
|
||||
// foreach (TranslationItem i in dbObject.TranslationItems)
|
||||
// {
|
||||
// newObject.TranslationItems.Add(new TranslationItem() { Key = i.Key, Display = i.Display });
|
||||
// }
|
||||
|
||||
// newObject.Id = 0;
|
||||
// newObject.Concurrency = 0;
|
||||
// await ct.Translation.AddAsync(newObject);
|
||||
// await ct.SaveChangesAsync();
|
||||
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||
// // await SearchIndexAsync(newObject, true);
|
||||
// // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
// return newObject;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// GET
|
||||
|
||||
|
||||
Reference in New Issue
Block a user