コード例 #1
0
        private ICollection <Doctor> getOpenSlotByDoctorPerGivenDate(ICollection <Doctor> doctorList, GetAppointmentSlotListRequest request, ICollection <int> doctorIdList = null)
        {
            var query = db.Appointments.Where(x => x.ConsultationTime.Value != null && x.ConsultationTime.Value == request.AppointmentDate);

            query                 = doctorIdList != null ?
                            query = query.Where(x => doctorIdList.Contains(x.DoctorId)) : query.Where(x => x.DoctorId == request.DoctorId);

            var doctorAppointmentList = query.ToList();
            var appointmentSlotList   = db.AppointmentSlots.ToList();
            var availableSolts        = filterAvailableSolts(doctorAppointmentList, appointmentSlotList);

            return(doctorList.Select(x => new Doctor
            {
                Id = x.Id,
                FirstName = x.FirstName,
                LastName = x.LastName,
                SpecializedIn = x.SpecializedIn,
                DepartmentId = x.DepartmentId,
                OpenAppointmentSlots = getOpenSlotList(availableSolts, x.Id)
            }).ToList());
        }
コード例 #2
0
        public ICollection <Doctor> GetAppointmentSlotList(GetAppointmentSlotListRequest request)
        {
            var doctorList = db.Doctors.Where(x => x.Id == request.DoctorId).ToList();

            return(getOpenSlotByDoctorPerGivenDate(doctorList, request));
        }