public ActionConfirmation Delete(int id) { RequestStatus requestStatusToDelete = _requestStatusRepository.Get(id); if (requestStatusToDelete != null) { _requestStatusRepository.Delete(requestStatusToDelete); try { _requestStatusRepository.DbContext.CommitChanges(); return(ActionConfirmation.CreateSuccessConfirmation( "The requestStatus was successfully deleted.")); } catch { _requestStatusRepository.DbContext.RollbackTransaction(); return(ActionConfirmation.CreateFailureConfirmation( "A problem was encountered preventing the requestStatus from being deleted. " + "Another item likely depends on this requestStatus.")); } } else { return(ActionConfirmation.CreateFailureConfirmation( "The requestStatus could not be found for deletion. It may already have been deleted.")); } }
public ActionResult <RequestStatus> DeleteRequestStatus(int id) { var requestStatus = _requestStatusRepository.Find(id); if (requestStatus == null) { return(NotFound()); } _requestStatusRepository.Delete(id); _requestStatusRepository.Save(); return(Ok()); }