예제 #1
0
        public async Task <IEnumerable <BookedDate> > FilterBookings(BookingsFilterParams filterParams, FiltersDictionary <BookedDate> filtersDictionary, string currentUserId)
        {
            if (!filterParams.FilterEnabled)
            {
                return(null);
            }

            var bookings = await database.BookedDateRepository.Filter(bd => bd.UserId == currentUserId || bd.Offer.CreatorId == currentUserId);

            bookings = filtersDictionary.RunFilters(bookings);

            bookings = BookingConfirmStatusSmartEnum.FromValue((int)filterParams.ConfirmStatus).Filter(bookings);
            bookings = BookingDateStatusSmartEnum.FromValue((int)filterParams.DateStatus).Filter(bookings);
            bookings = BookingTypeSmartEnum.FromValue((int)filterParams.Type).FilterBookings(bookings, currentUserId);

            return(bookings);
        }
 public IViewComponentResult Invoke(BookingsFilterParams filterParams) => View(filterParams);