This commit is contained in:
2020-05-21 23:58:57 +00:00
parent 4de095ca4e
commit 9d3986224c
5 changed files with 29 additions and 41 deletions

View File

@@ -58,11 +58,11 @@ namespace AyaNova.Biz
//
//put
internal async Task<bool> ReplaceAsync(GlobalOpsBackupSettings putObject)
internal async Task<GlobalOpsBackupSettings> PutAsync(GlobalOpsBackupSettings putObject)
{
var dbObject = await ct.GlobalOpsBackupSettings.FirstOrDefaultAsync(m => m.Id == 1);
if (dbObject == null)
throw new System.Exception("GlobalOpsSettingsBiz::ReplaceAsync -> Global settings object not found in database!!");
throw new System.Exception("GlobalOpsSettingsBiz::PutAsync -> Global settings object not found in database!!");
//If backup time has changed then reset last backup as well as it might block from taking effect
if (putObject.BackupTime.Hour != dbObject.BackupTime.Hour && putObject.BackupTime.Minute != dbObject.BackupTime.Minute)
@@ -73,12 +73,12 @@ namespace AyaNova.Biz
ct.Entry(dbObject).OriginalValues["Concurrency"] = putObject.Concurrency;
Validate(dbObject);
if (HasErrors)
return false;
return null;
await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, 1, BizType, AyaEvent.Modified), ct);
//Update the static copy for the server
ServerGlobalOpsSettingsCache.Backup=dbObject;
return true;
return dbObject;
}