using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; namespace Infrastructure.Extensions { public static class QueryableExtensions { public static IQueryable WhereIf(this IQueryable source, bool condition, Expression> predicate) { return condition ? source.Where(predicate) : source; } public static List Paged(this IQueryable source, int pageIndex, int pageSize) { return source.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList(); } } }