Esempio n. 1
0
        public IActionResult Post([FromBody] PatientModel patientModel)
        {
            if (patientModel == null)
            {
                return(BadRequest("Patient is null."));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            ;

            var patient = new Patient {
                PatientXML = patientModel.ToXML()
            };

            _dataRepository.Add(patient);
            return(CreatedAtRoute(
                       "Get",
                       new
            {
                Id = patient.Id
            },
                       patient.ToPatientModel()));
        }