public Part LookupAssociatedPart(int partID) { var part = AssociatedParts.Where(p => p.PartID == partID).FirstOrDefault(); if (part == null) { throw new Exception(message: $"A part with ID #{partID} is not associated with this product."); } return(part); }
public Part LookupAssociatePart(int partId) { var part = AssociatedParts.Where(x => x.PartId == partId).FirstOrDefault(); if (part == null) { throw new Exception(message: "No matching parts could be found."); } return(part); }
public bool RemoveAssociatePart(int partId) { var partToRemove = AssociatedParts.Where(x => x.PartId == partId).FirstOrDefault(); if (partToRemove == null) { return(false); } AssociatedParts.Remove(partToRemove); return(true); }