Example #1
0
 private static void RegisterFilters(GameFilterChain gameFilterChain, GameFilterInput filters)
 {
     gameFilterChain.Register(new PlatformFilter(filters.PlatformIds))
     .Register(new GenreFilter(filters.GenreIds))
     .Register(new PublisherFilter(filters.PublisherIds))
     .Register(new GameNameFilter(filters.SearchString))
     .Register(new GamePriceFilter(filters.MinPrice, filters.MaxPrice))
     .Register(new GamePublishDateFilter(filters.PeriodType));
 }
Example #2
0
        public IEnumerable <GameOutput> GetFiltered(GameFilterInput filters, int takeCount, int skipCount)
        {
            var gameFilterChain = new GameFilterChain();

            RegisterFilters(gameFilterChain, filters);
            var sortFilter    = new SortFilter(filters.SortType);
            var sortPredicate = sortFilter.Execute(x => x);
            var predicate     = gameFilterChain.Execute(x => !x.IsDeleted);

            return(Mapper.Map <List <GameOutput> >(_unitOfWork.GetGamesFromAllDbs().GetSorted(sortPredicate, predicate).Skip(skipCount).Take(takeCount)));
        }