public IActionResult DeleteCustomer([FromRoute] int customerId) { var customerEntity = _customerInfoRepository.GetCustomer(customerId); if (customerEntity == null) { return(NotFound()); } _customerInfoRepository.DeleteCustomer(_customerInfoRepository.GetCustomer(customerId)); if (!_customerInfoRepository.Save()) { return(StatusCode(500, "A thing happened which caused the program to stop responding")); } return(NoContent()); }