This commit is contained in:
@@ -36,86 +36,80 @@ 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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// GET
|
||||
internal async Task<DataListTemplate> GetNoLogAsync(long fetchId)
|
||||
{
|
||||
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
|
||||
return await ct.DataListTemplate.SingleOrDefaultAsync(m => m.Id == fetchId);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//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;
|
||||
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //EXISTS
|
||||
// internal async Task<bool> ExistsAsync(long id)
|
||||
// {
|
||||
// return await ct.DataListTemplate.AnyAsync(e => e.Id == id);
|
||||
// }
|
||||
|
||||
|
||||
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;
|
||||
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //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;
|
||||
|
||||
|
||||
TempContext.DataListTemplate.Add(outObj);
|
||||
TempContext.SaveChanges();
|
||||
// await ct.DataListTemplate.AddAsync(outObj);
|
||||
// await ct.SaveChangesAsync();
|
||||
|
||||
//Handle child and associated items:
|
||||
// //Handle child and associated items:
|
||||
|
||||
//EVENT LOG
|
||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext);
|
||||
// //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);
|
||||
// //SEARCH INDEXING
|
||||
// // Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Name);
|
||||
|
||||
return outObj;
|
||||
// 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
|
||||
internal async Task<DataListTemplate> GetAsync(long fetchId)
|
||||
internal async Task<DataListTemplate> GetAsync(string DataListKey, bool log=true)
|
||||
{
|
||||
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
|
||||
var ret = await ct.DataListTemplate.SingleOrDefaultAsync(m => m.Id == fetchId && (m.Public == true || m.UserId == UserId));
|
||||
@@ -128,26 +122,34 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
//get picklist (NOT PAGED)
|
||||
internal async Task<List<NameIdItem>> GetPickListAsync(string listKey)
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// GET
|
||||
internal async Task<DataListTemplate> GetNoLogAsync(long fetchId)
|
||||
{
|
||||
List<NameIdItem> items = new List<NameIdItem>();
|
||||
if (!string.IsNullOrWhiteSpace(listKey))
|
||||
{
|
||||
items = await ct.DataListTemplate
|
||||
.AsNoTracking()
|
||||
.Where(m => m.ListKey == listKey && (m.Public == true || m.UserId == UserId))
|
||||
.OrderBy(m => m.Name)
|
||||
.Select(m => new NameIdItem()
|
||||
{
|
||||
Id = m.Id,
|
||||
Name = m.Name
|
||||
}).ToListAsync();
|
||||
|
||||
}
|
||||
return items;
|
||||
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
|
||||
return await ct.DataListTemplate.SingleOrDefaultAsync(m => m.Id == fetchId);
|
||||
}
|
||||
|
||||
// //get picklist (NOT PAGED)
|
||||
// internal async Task<List<NameIdItem>> GetPickListAsync(string listKey)
|
||||
// {
|
||||
// List<NameIdItem> items = new List<NameIdItem>();
|
||||
// if (!string.IsNullOrWhiteSpace(listKey))
|
||||
// {
|
||||
// items = await ct.DataListTemplate
|
||||
// .AsNoTracking()
|
||||
// .Where(m => m.ListKey == listKey && (m.Public == true || m.UserId == UserId))
|
||||
// .OrderBy(m => m.Name)
|
||||
// .Select(m => new NameIdItem()
|
||||
// {
|
||||
// Id = m.Id,
|
||||
// Name = m.Name
|
||||
// }).ToListAsync();
|
||||
|
||||
// }
|
||||
// return items;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user