public IActionResult PostWithGeneralBloodAnalysis(int id, [FromForm] GeneralBloodAnalysisView generalBloodAnalysisView) { try { if (id == 0) { return(BadRequest("id is zero")); } if (generalBloodAnalysisView == null) { return(BadRequest("Owner object is null")); } if (!ModelState.IsValid) { return(BadRequest("Invalid model object")); } _medicalExaminationRepository.InsertGeneralBloodAnalysis(id, generalBloodAnalysisView.ViewToEntity()); return(Ok()); } catch (Exception ex) { return(StatusCode(500, string.Format("Internal server error. Message error: {0}", ex.Message))); } }
public IActionResult PostGeneralBloodAnalysis([FromBody] GeneralBloodAnalysisView generalBloodAnalysis) { try { if (generalBloodAnalysis == null) { return(BadRequest("Owner object is null")); } if (!ModelState.IsValid) { return(BadRequest("Invalid model object")); } generalBloodAnalysis.Id = 0; _generalBloodAnalysisRepository.Insert(generalBloodAnalysis.ViewToEntity()); return(Ok()); } catch (Exception ex) { return(StatusCode(500, "Internal server error" + ex.Message)); } }