This commit is contained in:
2020-01-22 15:52:06 +00:00
parent 7d3d9cfeee
commit e8aee43b6f
3 changed files with 7 additions and 39 deletions

View File

@@ -36,7 +36,7 @@ TEST CHANGES
TODO: REFACTOR GetNoLogAsync function is used in many places redundantly when the logging version could do the same thing but not log it with an optional bool switch so refactor that shit
TODO: REFACTOR biz objects have two creates, an async and sync one, WTF is that about? See if can make it just one async version.
DO CLIENT STUFF NOW COME BACK TO THIS STUFF LATER

View File

@@ -1,10 +1,8 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.JsonPatch;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;

View File

@@ -113,6 +113,11 @@ namespace AyaNova.Biz
{
//DataListKey always exists, if not in db then in default form
var ret = await ct.DataListTemplate.SingleOrDefaultAsync(m => m.DataListKey == DataListKey);
//Not in db? then put it in the db with the default then return it
if (ret == null)
{
}
if (log)
{
@@ -123,47 +128,14 @@ namespace AyaNova.Biz
}
// ////////////////////////////////////////////////////////////////////////////////////////////////
// /// 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);
// }
// //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;
// }
////////////////////////////////////////////////////////////////////////////////////////////////
//UPDATE
//
//put
internal bool Put(DataListTemplate dbObj, DataListTemplate inObj)
internal bool Put(DataListTemplate dbObj, DataListTemplate inObj, IAyaDataList dataList)
{
//preserve the owner ID if none was specified
if (inObj.UserId == 0)
inObj.UserId = dbObj.UserId;
//Replace the db object with the PUT object
CopyObject.Copy(inObj, dbObj, "Id");
@@ -178,8 +150,6 @@ namespace AyaNova.Biz
//Log modification
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
//Update keywords
// Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Name);
return true;
}