/// <summary> /// FilterContainer expression. /// </summary> /// <typeparam name="T">Return type.</typeparam> /// <param name="query">Integrable request.</param> /// <param name="request">Container for filters.</param> /// <returns>Performed query.</returns> public static IQueryable <T> Request <T>(this IQueryable <T> query, FilterContainer request) { IQueryable <T> res = query .Where(request.Where) .OrderBy(request.OrderBy); if (request.Skip >= 0) { res = res.Skip(request.Skip); } if (request.Take > 0) { res = res.Take(request.Take); } return(res); }
/// <summary> /// FilterContainer expression. /// </summary> /// <typeparam name="T">Return type.</typeparam> /// <param name="query">An enumerated request.</param> /// <param name="request">Container for filters.</param> /// <returns>Performed query.</returns> public static IQueryable <T> Request <T>(this IEnumerable <T> query, FilterContainer request) { return(query.AsQueryable().Request(request)); }