public IActionResult DeleteStaffMember(int id) { var staffMemberFromRepo = _supermarketRepository.GetStaffMemberById(id); if (staffMemberFromRepo == null) { return(NotFound()); } _supermarketRepository.DeleteStaffMember(staffMemberFromRepo); if (!_supermarketRepository.Save()) { throw new Exception($"Deleting staff member {id} failed on save."); } return(NoContent()); }