public IHttpActionResult Delete(int id) { Parts _parts = _unitOfWork.Parts.GetPartsWithPartId(id); if (_parts == null || _parts.IsDelete) { return(NotFound()); } _parts.Deleted(); _unitOfWork.Complete(); return(Ok()); }
public IHttpActionResult Delete(int id) { Parts _parts = _unitOfWork.Parts.GetPartsWithPartId(id); Inventory _inventory = _unitOfWork.Inventory.GetInventoryByPartsId(id); if (_parts == null || _parts.IsDelete) { return(NotFound()); } _parts.Deleted(); if (_parts.IsDelete == true) { if (_inventory != null) { _unitOfWork.Inventory.DeleteInventory(_inventory); } } _unitOfWork.Complete(); return(Ok()); }