public async Task <ResponseModel> CreateDoctor(PatientDoctorDTO patientDoctor) { ResponseModel response; try { var record = mapper.Map <PatientDoctor>(patientDoctor); await patientDoctorsService.CreatePatientDoctor(record); response = new ResponseModel { HttpResponse = (int)HttpStatusCode.Created, Response = "El registro fue creado con exito" }; } catch (Exception ex) { response = new ResponseModel { HttpResponse = (int)HttpStatusCode.InternalServerError, ErrorResponse = ex.Message }; } return(response); }
public PatientDoctorDTO CreatePatientDoctor([FromBody] PatientDoctorDTO patientDoctor) { PatientDoctor patientDoctorEntity = _mapper.Map <PatientDoctor>(patientDoctor); _repository.CreatePatientDoctor(patientDoctorEntity); _repository.Save(); PatientDoctorDTO newPatientDoctor = _mapper.Map <PatientDoctorDTO>(patientDoctorEntity); return(newPatientDoctor); }
public IActionResult CreatePatientDoctor([FromBody] PatientDoctorDTO patientDoctor) { PatientDoctorDTO newPatientDoctor = _patientDoctorService.CreatePatientDoctor(patientDoctor); return(Ok(newPatientDoctor)); }