Exemplo n.º 1
0
        public async Task <List <CalendarBooking> > GetBookingForCalendar(string serviceType)
        {
            var blockedDates = await blockedDateRepository.ListAll();

            var calendarData = await bookingRepository.GetCalendarBookings(DateTime.Today.AddDays(1), DateTime.Now.AddMonths(3), serviceType);

            var          calendar = new List <CalendarBooking>();
            TimeZoneInfo nzSTZone = TimeZoneInfo.FindSystemTimeZoneById("New Zealand Standard Time");

            foreach (var calendarDay in calendarData)
            {
                var isBlocked = false;
                foreach (var blockedDate in blockedDates)
                {
                    var convertedDatetime = TimeZoneInfo.ConvertTimeFromUtc(blockedDate.Blocked, nzSTZone);
                    var a = convertedDatetime.ToString("yyyy-MM-dd");
                    var b = calendarDay.start;
                    if (calendarDay.start == convertedDatetime.ToString("yyyy-MM-dd"))
                    {
                        isBlocked = true;
                    }
                }
                if (!isBlocked)
                {
                    calendar.Add(calendarDay);
                }
            }
            return(calendar);
        }
Exemplo n.º 2
0
        public async Task <List <BlockedDate> > GetAll()
        {
            var allBlockedDate = await blockedDateRepository.ListAll();

            return(allBlockedDate);
        }