This commit is contained in:
2020-06-25 17:39:31 +00:00
parent 2322135bb4
commit d52be28f0c
2 changed files with 49 additions and 9 deletions

View File

@@ -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