コード例 #1
0
        public IActionResult Post([FromBody] Patient patient)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            if (_patientService.CheckPatientExists(patient))
            {
                return(StatusCode(409, $"User '{patient.Name}' already exists."));
            }

            return(Ok(_patientService.AddPatient(patient)));
        }