Пример #1
0
 public static IQueryable <T> GenerateQuery <T>(this IQueryable <T> query, JsonapiRequest request)
 {
     if (request != null)
     {
         query = query.GenerateFilterQuery <T>(request.Filters);
         query = query.GenerateSortQuery <T>(request.Sort);
         query = query.GeneratePagination <T>(request.Pagination);
     }
     return(query);
 }
Пример #2
0
        public static JsonapiRequest GetJsonApiRequest(IEnumerable <KeyValuePair <string, string> > parameters)
        {
            if (parameters.Any())
            {
                JsonapiRequest jsonAPIRequest = new JsonapiRequest();
                jsonAPIRequest.Sort       = ExtractSortExpressions(parameters);
                jsonAPIRequest.Filters    = ExtractFilters(parameters);
                jsonAPIRequest.Pagination = ExtractPagination(parameters);

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