Skip to content

Commit

Permalink
Fixes #240 - Can not delete a part when a datasheet is attached
Browse files Browse the repository at this point in the history
  • Loading branch information
replaysMike committed Mar 13, 2024
1 parent 41fe41d commit f4adc6e
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public async Task<bool> DeletePartAsync(Part part, IUserContext userContext)
if (entity == null)
return false;
EnforceIntegrityCreate(entity, userContext);
await context.PartSuppliers.Where(x => x.PartId == part.PartId).ExecuteDeleteAsync();
await context.ProjectPartAssignments.Where(x => x.PartId == part.PartId).ExecuteDeleteAsync();
await context.StoredFiles.Where(x => x.PartId == part.PartId).ExecuteDeleteAsync();
context.Parts.Remove(entity);
await context.SaveChangesAsync();
_partTypesCache.InvalidateCache();
Expand Down

0 comments on commit f4adc6e

Please sign in to comment.