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

@@ -300,12 +300,11 @@ namespace AyaNova.Biz
private async Task ValidateCanDeleteAsync(HeadOffice inObj)
{
//Referential integrity
//FOREIGN KEY CHECKS
if (await ct.User.AnyAsync(m => m.HeadOfficeId == inObj.Id))
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("User"));
if (await ct.Customer.AnyAsync(z => z.HeadOfficeId == 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", await Translate("Customer"));
}
}