예제 #1
0
        public ActionResult ScheduleAppointmentByDoctor([FromBody] ExaminationDTO scheduleExaminationDTO)
        {
            Examination scheduleExamination = ExaminationMapper.ExmainationDTO_To_Examination(scheduleExaminationDTO);
            int         idExamination       = _scheduleAppintmentService.ScheduleAnAppointmentByDoctor(scheduleExamination);

            return(Ok(idExamination));
        }
예제 #2
0
        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));
            }
        }
예제 #3
0
        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());
        }
예제 #4
0
        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));
        }
예제 #5
0
 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));
     }
 }
예제 #6
0
        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);
 }