This commit is contained in:
@@ -156,7 +156,7 @@ namespace AyaNova.Biz
|
||||
AddError(ApiErrorCode.NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
ValidateCanDelete(dbObject);
|
||||
await ValidateCanDeleteAsync(dbObject);
|
||||
if (HasErrors)
|
||||
return false;
|
||||
if (HasErrors)
|
||||
@@ -255,9 +255,13 @@ namespace AyaNova.Biz
|
||||
|
||||
}
|
||||
|
||||
private void ValidateCanDelete(Contract inObj)
|
||||
private async Task ValidateCanDeleteAsync(Contract inObj)
|
||||
{
|
||||
//whatever needs to be check to delete this object
|
||||
//FOREIGN KEY CHECKS
|
||||
if (await ct.Customer.AnyAsync(m => m.ContractId == inObj.Id))
|
||||
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("Customer"));
|
||||
if (await ct.HeadOffice.AnyAsync(m => m.ContractId == inObj.Id))
|
||||
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("HeadOffice"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user