Exemplo n.º 1
0
        public IActionResult Index([FromBody] PatientCreationModel newPatient)
        {
            if (ModelState.IsValid)
            {
                var patientInfo = patientService.Add(newPatient);
                return(Ok(patientInfo));
            }

            return(BadRequest(ModelState));
        }
Exemplo n.º 2
0
        public PatientInfoModel Add(PatientCreationModel patient)
        {
            var appPatient = Mapper.Map <PatientCreationModel, Patient>(patient);

            repository.Insert(appPatient);

            var infoPatient = Mapper.Map <Patient, PatientInfoModel>(appPatient);

            return(infoPatient);
        }