Пример #1
0
        public Paged <AvailableTimeSlot> GetAll(int pageIndex, int pageSize, int sessionDuration)
        {
            Paged <AvailableTimeSlot> page = null;
            List <AvailableTimeSlot>  list = null;
            int totalCount = 0;

            _data.ExecuteCmd("[dbo].[ScheduleAvailability_Select_NextFiveAvailable]"
                             , delegate(SqlParameterCollection col)
            {
                col.AddWithValue("@pageIndex", pageIndex);
                col.AddWithValue("@pageSize", pageSize);
                col.AddWithValue("@sessionDuration", sessionDuration);
            }
                             , delegate(IDataReader reader, short set)
            {
                AvailableTimeSlot availableTimeSlot = MapAvailableTimeSlot(reader, out int index);

                if (list == null)
                {
                    list = new List <AvailableTimeSlot>();
                }
                if (totalCount == 0)
                {
                    totalCount = reader.GetSafeInt32(index++);
                }
                list.Add(availableTimeSlot);
            });

            if (list != null)
            {
                page = new Paged <AvailableTimeSlot>(list, pageIndex, pageSize, totalCount);
            }
            return(page);
        }
Пример #2
0
        private static AvailableTimeSlot MapAvailableTimeSlot(IDataReader reader, out int index)
        {
            AvailableTimeSlot availableTimeSlot = new AvailableTimeSlot();

            index = 0;
            availableTimeSlot.BlockStart = reader.GetSafeDateTime(index++);
            availableTimeSlot.BlockEnd   = reader.GetSafeDateTime(index++);

            return(availableTimeSlot);
        }
Пример #3
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (TimeSlotId == null)
            {
                return(RedirectToPage("/Appointments/Doctors"));
            }

            AvailableTimeSlot slot = await getSlotQuery.ExecuteAsync(TimeSlotId.Value);

            if (slot == null)
            {
                return(RedirectToPage("/Appointments/Doctors"));
            }

            Slot = slot;

            return(Page());
        }