Exemplo n.º 1
0
 private static IQueryable <T> ApplySort <T>(this IQueryable <T> query, Sorts <T> sorts)
 {
     if (!sorts.IsValid())
     {
         return(query);
     }
     return(Sorts <T> .ApplySorts(query, sorts));
 }
Exemplo n.º 2
0
        internal static IQueryable <T> ApplySorts(IQueryable <T> query, Sorts <T> sorts)
        {
            var isFirstSort   = true;
            var validSortings = sorts.GetAll();
            IOrderedQueryable <T> orderedQuery = null;

            foreach (var sort in validSortings)
            {
                orderedQuery = isFirstSort
                    ? ApplySorting(query, sort)
                    : ApplySorting(orderedQuery, sort);
                isFirstSort = false;
            }

            return(orderedQuery ?? query);
        }
Exemplo n.º 3
0
 public static async Task <PagedResults <T> > Paginate <T>(this IQueryable <T> query, PagingOptions options, Sorts <T> sorts, Filters <T> filters)
 {
     return(await query.ApplyFilter(filters).Paginate(options, sorts));
 }