This commit is contained in:
@@ -59,20 +59,23 @@ namespace AyaNova.Biz
|
||||
//
|
||||
|
||||
//put
|
||||
internal async Task<bool> ReplaceAsync(GlobalBizSettings global)
|
||||
internal async Task<bool> ReplaceAsync(GlobalBizSettings inObj)
|
||||
{
|
||||
var o = await ct.GlobalBizSettings.FirstOrDefaultAsync(m => m.Id == 1);
|
||||
if (o == null)
|
||||
var dbObj = await ct.GlobalBizSettings.FirstOrDefaultAsync(m => m.Id == 1);
|
||||
if (dbObj == null)
|
||||
throw new System.Exception("GlobalBizSettingsBiz::ReplaceAsync -> Global settings object not found in database!!");
|
||||
CopyObject.Copy(global, o);
|
||||
Validate(o);
|
||||
CopyObject.Copy(inObj, dbObj, "Id");
|
||||
|
||||
ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = inObj.ConcurrencyToken;
|
||||
|
||||
Validate(dbObj);
|
||||
if (HasErrors)
|
||||
return false;
|
||||
await ct.SaveChangesAsync();
|
||||
//Log modification and save context
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, 1, BizType, AyaEvent.Modified), ct);
|
||||
//Update the static copy for the server
|
||||
ServerGlobalBizSettings.Initialize(o);
|
||||
ServerGlobalBizSettings.Initialize(dbObj);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user