This commit is contained in:
2021-02-11 00:53:48 +00:00
parent 0749539172
commit 8fdfa3482d
9 changed files with 72 additions and 48 deletions

View File

@@ -120,10 +120,10 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.CONCURRENCY_CONFLICT);
return null;
}
putObject.Tags = TagBiz.NormalizeTags(putObject.Tags);
putObject.CustomFields = JsonUtil.CompactJson(putObject.CustomFields);
await ValidateAsync(putObject, dbObject);
await ValidateAsync(putObject, dbObject);
if (HasErrors) return null;
ct.Replace(dbObject, putObject);
try
@@ -335,14 +335,12 @@ namespace AyaNova.Biz
//Referential integrity error
//Just an example
// if (await ct.User.AnyAsync(z => z.CustomerId == inObj.Id) == true)
// {
// //Note: errorbox will ensure it appears in the general errror box and not field specific
// //the translation key is to indicate what the linked object is that is causing the error
// AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", "LT:Contact");
// }
//FOREIGN KEY CHECKS
if (await ct.User.AnyAsync(m => m.CustomerId == inObj.Id))
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("User"));
if (await ct.Unit.AnyAsync(m => m.CustomerId == inObj.Id))
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("Unit"));
await Task.CompletedTask;
}