This commit is contained in:
@@ -129,7 +129,7 @@ namespace AyaNova.Biz
|
|||||||
internal async Task<PartAssembly> GetAsync(long id, bool logTheGetEvent = true)
|
internal async Task<PartAssembly> GetAsync(long id, bool logTheGetEvent = true)
|
||||||
{
|
{
|
||||||
//.Include(w => w.Items)
|
//.Include(w => w.Items)
|
||||||
var ret = await ct.PartAssembly.AsNoTracking().Include(z=>z.Items).SingleOrDefaultAsync(m => m.Id == id);
|
var ret = await ct.PartAssembly.AsNoTracking().Include(z => z.Items).SingleOrDefaultAsync(m => m.Id == id);
|
||||||
if (logTheGetEvent && ret != null)
|
if (logTheGetEvent && ret != null)
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -140,15 +140,16 @@ namespace AyaNova.Biz
|
|||||||
//
|
//
|
||||||
internal async Task<PartAssembly> PutAsync(PartAssembly putObject)
|
internal async Task<PartAssembly> PutAsync(PartAssembly putObject)
|
||||||
{
|
{
|
||||||
PartAssembly dbObject = await ct.PartAssembly.SingleOrDefaultAsync(m => m.Id == putObject.Id);
|
// PartAssembly dbObject = await ct.PartAssembly.SingleOrDefaultAsync(m => m.Id == putObject.Id);
|
||||||
|
PartAssembly dbObject = await GetAsync(putObject.Id, false);
|
||||||
if (dbObject == null)
|
if (dbObject == null)
|
||||||
{
|
{
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
PartAssembly SnapshotOfOriginalDBObj = new PartAssembly();
|
// PartAssembly SnapshotOfOriginalDBObj = new PartAssembly();
|
||||||
CopyObject.Copy(dbObject, SnapshotOfOriginalDBObj);
|
//CopyObject.Copy(dbObject, SnapshotOfOriginalDBObj);
|
||||||
CopyObject.Copy(putObject, dbObject, "Id");
|
//CopyObject.Copy(putObject, dbObject, "Id");
|
||||||
dbObject.Tags = TagBiz.NormalizeTags(dbObject.Tags);
|
dbObject.Tags = TagBiz.NormalizeTags(dbObject.Tags);
|
||||||
dbObject.CustomFields = JsonUtil.CompactJson(dbObject.CustomFields);
|
dbObject.CustomFields = JsonUtil.CompactJson(dbObject.CustomFields);
|
||||||
ct.Entry(dbObject).OriginalValues["Concurrency"] = putObject.Concurrency;
|
ct.Entry(dbObject).OriginalValues["Concurrency"] = putObject.Concurrency;
|
||||||
|
|||||||
Reference in New Issue
Block a user