public IActionResult DeletePathWay(int id) { if (!_repo.PathWayExists(id)) { return(NotFound()); } var pw = _repo.GetById(id); if (!_repo.DeletePathWay(pw)) { ModelState.AddModelError("Error !", $"Something went wrong when deleting the record {pw.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }