public IActionResult UpdatePathWay(int id, [FromBody] PathwayUpdateDTO pathwayUpsertDTO) { if (pathwayUpsertDTO == null || pathwayUpsertDTO.Id != id) { return(BadRequest(ModelState)); } var pw = _mapper.Map <PathWay>(pathwayUpsertDTO); if (!_repo.UpdatePathWay(pw)) { ModelState.AddModelError("Error !", $"Something went wrong when updating the record {pw.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }