This commit is contained in:
2020-12-08 23:57:24 +00:00
parent 45093403f7
commit 85a15e1450

View File

@@ -164,8 +164,6 @@ namespace AyaNova.Biz
//DELETE DIRECT CHILD OBJECTS
//(note: the convention is to allow deletion of children created *in* the same UI area so this will delete contacts, customer notes, but not workorders of this customer for example)
//Will need to possibly display refintegrity error from the *linked* object delete attemp, i.e. Contact for here
//so should test that out so that it flows to the UI so user understands they can't delete the Customer due to a Contact having links to other objects
{
var ContactIds = await ct.User.AsNoTracking().Where(z => z.CustomerId == id).Select(z => z.Id).ToListAsync();
if (ContactIds.Count() > 0)
@@ -174,7 +172,7 @@ namespace AyaNova.Biz
foreach (long ItemId in ContactIds)
if (!await b.DeleteAsync(ItemId, transaction))
{
AddError(ApiErrorCode.CHILD_OBJECT_ERROR, null, b.GetErrorsAsString());
AddError(ApiErrorCode.CHILD_OBJECT_ERROR, null, $"CustomerContact [{ItemId}]: {b.GetErrorsAsString()}");
return false;
}
}
@@ -187,7 +185,7 @@ namespace AyaNova.Biz
foreach (long ItemId in CustomerNoteIds)
if (!await b.DeleteAsync(ItemId, transaction))
{
AddError(ApiErrorCode.CHILD_OBJECT_ERROR, null, b.GetErrorsAsString());
AddError(ApiErrorCode.CHILD_OBJECT_ERROR, null, $"CustomerNote [{ItemId}]: {b.GetErrorsAsString()}");
return false;
}
}