private void InitializeFilters(IFilterChain <IQueryable <Game> > gameFilter, IFilterChain <IQueryable <Product> > productFilter, FilterArgs model) { gameFilter.Register(new GenreFilter(model.SelectedGenres ?? _genreService.GetAllItems().Select(x => x.Id))); gameFilter.Register(new PlatformFilter(model.SelectedPlatforms ?? _platformService.GetAllItems().Select(x => x.Id))); gameFilter.Register(new PublisherFilter(model.SelectedPublishers ?? _publisherService.GetAllItems().Select(x => x.Id))); gameFilter.Register(new PriceFilter((double)model.MinPrice, (double)model.MaxPrice)); gameFilter.Register(new GameNameFilter(model.GameName)); gameFilter.Register(new DateFilter((model.SelectedDate ?? new DatesFilter()).ToString())); productFilter.Register(new CategoryFilter(model.SelectedGenres)); productFilter.Register(new SupplierFilter(model.SelectedPublishers)); productFilter.Register(new ProductPriceRangeFilter(model.MinPrice, model.MaxPrice)); productFilter.Register(new ProductNameFilter(model.GameName)); }
private void InitializeSorting(IFilterChain <IQueryable <Game> > filter, FilterArgs model) { filter.Register(new PopularityFilter(model.FilterType)); }