public IActionResult PostWithMRI(int id, [FromForm] MRIView mri) { try { if (id == 0) { return(BadRequest("id is zero")); } if (mri == null) { return(BadRequest("Owner object is null")); } if (!ModelState.IsValid) { return(BadRequest("Invalid model object")); } _injuriesDiseasesRepository.InsertMRI(id, mri.ViewToEntity()); return(Ok()); } catch (Exception ex) { return(StatusCode(500, string.Format("Internal server error. Message error: {0}", ex.Message))); } }
public IActionResult PostHeartUltrasound([FromBody] MRIView mri) { try { if (mri == null) { return(BadRequest("Owner object is null")); } if (!ModelState.IsValid) { return(BadRequest("Invalid model object")); } mri.Id = 0; _MRIRepository.Insert(mri.ViewToEntity()); return(Ok()); } catch (Exception ex) { return(StatusCode(500, "Internal server error" + ex.Message)); } }