public IActionResult Index([FromBody] PatientCreationModel newPatient) { if (ModelState.IsValid) { var patientInfo = patientService.Add(newPatient); return(Ok(patientInfo)); } return(BadRequest(ModelState)); }
public PatientInfoModel Add(PatientCreationModel patient) { var appPatient = Mapper.Map <PatientCreationModel, Patient>(patient); repository.Insert(appPatient); var infoPatient = Mapper.Map <Patient, PatientInfoModel>(appPatient); return(infoPatient); }