This commit is contained in:
2020-01-22 16:04:23 +00:00
parent e8aee43b6f
commit 8267365370

View File

@@ -36,79 +36,10 @@ namespace AyaNova.Biz
return new DataListTemplateBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, AuthorizationRoles.BizAdminFull);
}
// ////////////////////////////////////////////////////////////////////////////////////////////////
// //EXISTS
// internal async Task<bool> ExistsAsync(long id)
// {
// return await ct.DataListTemplate.AnyAsync(e => e.Id == id);
// }
// ////////////////////////////////////////////////////////////////////////////////////////////////
// //CREATE
// internal async Task<DataListTemplate> CreateAsync(DataListTemplate inObj)
// {
// Validate(inObj, true);
// if (HasErrors)
// return null;
// else
// {
// //do stuff with datafilter
// DataListTemplate outObj = inObj;
// outObj.UserId = UserId;
// await ct.DataListTemplate.AddAsync(outObj);
// await ct.SaveChangesAsync();
// //Handle child and associated items:
// //EVENT LOG
// EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
// //SEARCH INDEXING
// // Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Name);
// return outObj;
// }
// }
// ////////////////////////////////////////////////////////////////////////////////////////////////
// //CREATE
// internal DataListTemplate Create(AyContext TempContext, DataListTemplate inObj)
// {
// Validate(inObj, true);
// if (HasErrors)
// return null;
// else
// {
// //do stuff with datafilter
// DataListTemplate outObj = inObj;
// outObj.UserId = UserId;
// TempContext.DataListTemplate.Add(outObj);
// TempContext.SaveChanges();
// //Handle child and associated items:
// //EVENT LOG
// EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext);
// //SEARCH INDEXING
// // Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Name);
// return outObj;
// }
// }
////////////////////////////////////////////////////////////////////////////////////////////////
/// GET
//Get one
/// GET
internal async Task<DataListTemplate> GetAsync(string DataListKey, bool log, IAyaDataList dataList)
{
//DataListKey always exists, if not in db then in default form
@@ -116,7 +47,11 @@ namespace AyaNova.Biz
//Not in db? then put it in the db with the default then return it
if (ret == null)
{
ret = new DataListTemplate();
ret.DataListKey = dataList.ListKey;
ret.Template = dataList.DefaultDataListDisplayTemplate;
await ct.DataListTemplate.AddAsync(ret);
await ct.SaveChangesAsync();
}
if (log)
@@ -150,7 +85,6 @@ namespace AyaNova.Biz
//Log modification
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
return true;
}