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