public ActionResult ScheduleAppointmentByDoctor([FromBody] ExaminationDTO scheduleExaminationDTO) { Examination scheduleExamination = ExaminationMapper.ExmainationDTO_To_Examination(scheduleExaminationDTO); int idExamination = _scheduleAppintmentService.ScheduleAnAppointmentByDoctor(scheduleExamination); return(Ok(idExamination)); }
public IActionResult ScheduleExamination(ScheduledExaminationDTO dto) { if (dto.PatientId == 0) { dto.PatientId = Int32.Parse(HttpIdentityHandler.GetUserIdFromRequest(HttpContext.Request)); } var examination = ExaminationMapper.DtoToObject(dto); try { return(Ok(_examinationService.Schedule(examination))); } catch (NullReferenceException) { return(BadRequest("Examination cannot be null.")); } catch (ScheduleViolationException e) { return(BadRequest(e.Message)); } catch (ArgumentException e) { return(BadRequest(e.Message)); } }
public ActionResult ReScheduleAppointment([FromBody] RescheduleExaminationDTO rescheduleExaminationDTO) { Examination examinationForSchedule = ExaminationMapper.ExmainationDTO_To_Examination(rescheduleExaminationDTO.ExaminationForScheduleDTO); Examination examinationForReschedule = ExaminationMapper.ExmainationDTO_To_Examination(rescheduleExaminationDTO.ExaminationForRescheduleDTO); Examination shiftedExamination = ExaminationMapper.ExmainationDTO_To_Examination(rescheduleExaminationDTO.ShiftedExaminationDTO); _scheduleAppintmentService.ReScheduleAppointment(examinationForSchedule, examinationForReschedule, shiftedExamination); return(Ok()); }
public ActionResult GetFreeAppointments(AppointmentSearchWithPrioritiesDTO appointmentDTO) { List <Examination> examinations = (List <Examination>)_freeAppointmentSearchService.SearchWithPriorities(appointmentDTO); examinations.ForEach(e => e.Doctor = _doctorService.GetDoctorByJmbg(e.DoctorJmbg)); List <ExaminationDTO> allExaminations = new List <ExaminationDTO>(); examinations.ForEach(e => allExaminations.Add(ExaminationMapper.Examination_To_ExaminationDTO(e))); return(Ok(allExaminations)); }
public IActionResult GetExaminationById(int id) { try { Examination examination = _examinationService.GetExaminationById(id); return(Ok(ExaminationMapper.Examination_To_ExaminationDTO(examination))); } catch (DatabaseException e) { return(StatusCode(500, e.Message)); } catch (NotFoundException e) { return(NotFound(e.Message)); } }
public IActionResult ScheduleEmergencyExamination(ScheduledExaminationDTO dto) { var examination = ExaminationMapper.DtoToObject(dto); try { return(Ok(_examinationService.ScheduleEmergency(examination))); } catch (NullReferenceException) { return(BadRequest("Examination cannot be null.")); } catch (ScheduleViolationException e) { return(BadRequest(e.Message)); } catch (ArgumentException e) { return(BadRequest(e.Message)); } }
public EmergencyExaminationDTO(Examination unchangedExamination, Examination shiftedExamination) { UnchangedExamination = ExaminationMapper.Examination_To_ExaminationDTO(unchangedExamination); ShiftedExamination = ExaminationMapper.Examination_To_ExaminationDTO(shiftedExamination); }