Example #1
0
        public async Task <SearchResponse <T> > CreateResponse <T>(IQueryable <T> query, IEnumerable <IFilterItemStrategy <T> > filterItemStrategies)
        {
            if (FilterItems != null)
            {
                var predicate = await FilterItems.GetPredicate(filterItemStrategies);

                if (predicate != null)
                {
                    query = query.Where(predicate);
                }
            }
            var response = new SearchResponse <T>();

            query = await PaginateQuery(query, response);

            response.Items = await query.ToListAsync();

            return(response);
        }