예제 #1
0
 public async Task <IHttpActionResult> AddPatient([FromBody] PatientDTO patient)
 {
     try
     {
         return(await _manager.AddPateint(patient) ? Created <PatientDiagnosisDTO>("", null) : (IHttpActionResult)BadRequest("changes not excepted!"));
     }
     catch (Exception ex) { return(InternalServerError(ex)); }
 }
예제 #2
0
        public async Task <IHttpActionResult> AddPatient([FromBody] PatientDTO patient)
        {
            try
            {
                PatientDTO patientDTO = await _manager.AddPateint(patient);

                if (patientDTO == patient)
                {
                    return(BadRequest("Patient already exists with the given ID."));
                }
                else if (patientDTO != null)
                {
                    return(Created <PatientDTO>("Patient created successfuly", patientDTO));
                }
                else
                {
                    return((IHttpActionResult)BadRequest("changes not excepted!"));
                }
            }
            catch (Exception ex) { return(InternalServerError(ex)); }
        }