This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user