public IActionResult PostSurgicalIntervention(int id, [FromBody] SurgicalInterventionView surgicalInterventionView) { try { if (id == 0) { return(BadRequest("id is zero")); } if (surgicalInterventionView == null) { return(BadRequest("Owner object is null")); } if (!ModelState.IsValid) { return(BadRequest("Invalid model object")); } _generalInformationRepository.InsertSurgicalIntervention(id, surgicalInterventionView.ViewToEntity()); return(Ok()); } catch (Exception) { return(StatusCode(500, "Internal server error")); } }
public IActionResult PostSurgicalIntervention([FromBody] SurgicalInterventionView surgicalInterventionView) { try { if (surgicalInterventionView == null) { return(BadRequest("Owner object is null")); } if (!ModelState.IsValid) { return(BadRequest("Invalid model object")); } surgicalInterventionView.Id = 0; _surgicalInterventionRepository.Insert(surgicalInterventionView.ViewToEntity()); return(Ok()); } catch (Exception ex) { return(StatusCode(500, "Internal server error" + ex.Message)); } }