This commit is contained in:
@@ -712,6 +712,25 @@ namespace AyaNova.Biz
|
|||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//DELETE
|
||||||
|
//
|
||||||
|
internal async Task<bool> PartDeleteAsync(long id)
|
||||||
|
{
|
||||||
|
WorkOrderItemPart dbObject = await ct.WorkOrderItemPart.SingleOrDefaultAsync(m => m.Id == id);
|
||||||
|
PartValidateCanDelete(dbObject);
|
||||||
|
if (HasErrors)
|
||||||
|
return false;
|
||||||
|
ct.WorkOrderItemPart.Remove(dbObject);
|
||||||
|
await ct.SaveChangesAsync();
|
||||||
|
|
||||||
|
//Log event
|
||||||
|
await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, "woitem:" + dbObject.WorkOrderItemId.ToString(), ct);
|
||||||
|
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType);
|
||||||
|
await TagUtil.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//VALIDATION
|
//VALIDATION
|
||||||
//
|
//
|
||||||
@@ -741,11 +760,22 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// //Can delete?
|
//Can delete?
|
||||||
// private void PartValidateCanDelete(WorkOrderItemPart inObj)
|
private void PartValidateCanDelete(WorkOrderItemPart obj)
|
||||||
// {
|
{
|
||||||
// //whatever needs to be check to delete this object
|
if (obj == null)
|
||||||
// }
|
{
|
||||||
|
AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//re-check rights here necessary due to traversal delete from Principle object
|
||||||
|
if (!Authorized.HasDeleteRole(CurrentUserRoles, AyaType.WorkOrderItemPart))
|
||||||
|
{
|
||||||
|
AddError(ApiErrorCode.NOT_AUTHORIZED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task PartSearchIndexAsync(WorkOrderItemPart obj, bool isNew)
|
private async Task PartSearchIndexAsync(WorkOrderItemPart obj, bool isNew)
|
||||||
|
|||||||
Reference in New Issue
Block a user