예제 #1
0
        public async Task <IActionResult> AddPatient(PatientRequest patientRequest)
        {
            var patientExists = await _patientService.CheckIfAlreadyPresent(patientRequest);

            var patientUri = new Uri($"v1/patients", UriKind.Relative);

            if (patientExists != null)
            {
                return(Conflict(patientExists));
            }
            var addPatientTask = _patientService.AddPatient(patientRequest);
            var patient        = await addPatientTask;

            return(Created(patientUri, patient));
        }