Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        public IActionResult CreatePatientDoctor([FromBody] PatientDoctorDTO patientDoctor)
        {
            PatientDoctorDTO newPatientDoctor = _patientDoctorService.CreatePatientDoctor(patientDoctor);

            return(Ok(newPatientDoctor));
        }