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)); }
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))); }