This commit is contained in:
@@ -59,24 +59,24 @@ namespace AyaNova.Biz
|
||||
//
|
||||
|
||||
//put
|
||||
internal async Task<bool> ReplaceAsync(GlobalBizSettings inObj)
|
||||
internal async Task<GlobalBizSettings> PutAsync(GlobalBizSettings updatedObject)
|
||||
{
|
||||
var dbObj = await ct.GlobalBizSettings.FirstOrDefaultAsync(m => m.Id == 1);
|
||||
if (dbObj == null)
|
||||
var dbObject = await ct.GlobalBizSettings.FirstOrDefaultAsync(m => m.Id == 1);
|
||||
if (dbObject == null)
|
||||
throw new System.Exception("GlobalBizSettingsBiz::ReplaceAsync -> Global settings object not found in database!!");
|
||||
CopyObject.Copy(inObj, dbObj, "Id");
|
||||
CopyObject.Copy(updatedObject, dbObject, "Id");
|
||||
|
||||
ct.Entry(dbObj).OriginalValues["Concurrency"] = inObj.Concurrency;
|
||||
ct.Entry(dbObject).OriginalValues["Concurrency"] = updatedObject.Concurrency;
|
||||
|
||||
Validate(dbObj);
|
||||
Validate(dbObject);
|
||||
if (HasErrors)
|
||||
return false;
|
||||
return null;
|
||||
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(dbObj);
|
||||
return true;
|
||||
ServerGlobalBizSettings.Initialize(dbObject);
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user