Exemplo n.º 1
0
        public static IQueryable <T> GenerateQuery <T>(this IQueryable <T> query, JSONAPIRequest request)
        {
            query = query.GenerateFilterQuery <T>(request.Filters);
            query = query.GenerateSortQuery <T>(request.Sort);
            query = query.GeneratePagination <T>(request.Pagination);

            return(query);
        }
Exemplo n.º 2
0
        public static JSONAPIRequest GetJSONAPIRequest(IEnumerable <KeyValuePair <string, string> > parameters)
        {
            if (parameters.Count() > 0)
            {
                JSONAPIRequest jsonAPIRequest = new JSONAPIRequest();
                jsonAPIRequest.Sort       = ExtractSortExpressions(parameters);
                jsonAPIRequest.Filters    = ExtractFilters(parameters);
                jsonAPIRequest.Pagination = ExtractPagination(parameters);

                return(jsonAPIRequest);
            }
            return(null);
        }