This commit is contained in:
@@ -6,6 +6,7 @@ using AyaNova.Util;
|
||||
using AyaNova.Api.ControllerHelpers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using AyaNova.Models;
|
||||
using AyaNova.PickList;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
@@ -102,12 +103,20 @@ namespace AyaNova.Biz
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//GET
|
||||
//
|
||||
internal async Task<PartAssembly> GetAsync(long id, bool logTheGetEvent = true)
|
||||
internal async Task<PartAssembly> GetAsync(long id, bool logTheGetEvent = true, bool populatePartNames = false)
|
||||
{
|
||||
//.Include(w => w.Items)
|
||||
var ret = await ct.PartAssembly.AsNoTracking().Include(z => z.Items).SingleOrDefaultAsync(m => m.Id == id);
|
||||
if (logTheGetEvent && ret != null)
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
|
||||
|
||||
if (populatePartNames && ret.Items.Count > 0)
|
||||
{
|
||||
var partIdList = ret.Items.Select(z => z.PartId).ToList();
|
||||
var PickList = PickListFactory.GetAyaPickList(AyaType.Part);
|
||||
var partNames = await PickListFetcher.GetResponseAsync(PickList, null, null, true, partIdList, null, ct, log);
|
||||
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -127,7 +136,7 @@ namespace AyaNova.Biz
|
||||
|
||||
putObject.Tags = TagBiz.NormalizeTags(putObject.Tags);
|
||||
putObject.CustomFields = JsonUtil.CompactJson(putObject.CustomFields);
|
||||
await ValidateAsync(putObject, dbObject);
|
||||
await ValidateAsync(putObject, dbObject);
|
||||
if (HasErrors) return null;
|
||||
ct.Replace(dbObject, putObject);
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user