This commit is contained in:
2021-01-25 18:06:11 +00:00
parent 05f6fa0e7f
commit 22232450d7
5 changed files with 69 additions and 21 deletions

View File

@@ -57,21 +57,17 @@ namespace AyaNova.Biz
////////////////////////////////////////////////////////////////////////////////////////////////
//UPDATE
//
//put
internal async Task<GlobalBizSettings> PutAsync(GlobalBizSettings updatedObject)
internal async Task<GlobalBizSettings> PutAsync(GlobalBizSettings putObject)
{
var dbObject = await ct.GlobalBizSettings.FirstOrDefaultAsync(m => m.Id == 1);
var dbObject = await GetAsync(false);
if (dbObject == null)
throw new System.Exception("GlobalBizSettingsBiz::ReplaceAsync -> Global settings object not found in database!!");
CopyObject.Copy(updatedObject, dbObject, "Id");
throw new System.Exception("GlobalBizSettingsBiz::PutAsync -> Global settings object not found in database. Contact support immediately!");
Validate(putObject, dbObject);
if (HasErrors) return null;
ct.Replace(dbObject, putObject);
ct.Entry(dbObject).OriginalValues["Concurrency"] = updatedObject.Concurrency;
Validate(dbObject);
if (HasErrors)
return null;
try
{
await ct.SaveChangesAsync();
@@ -95,9 +91,8 @@ namespace AyaNova.Biz
//
//Can save or update?
private void Validate(GlobalBizSettings inObj)
private void Validate(GlobalBizSettings proposedObj, GlobalBizSettings currentObj)
{
//currently nothing to validate
}