public virtual Tuple <int, IList <T> > FindPagenatedListWithCount <K>(int pageIndex, int pageSize, Expression <Func <T, bool> > predicate, string sortProperty, bool ascending = true) { IQueryable <T> q = QueryableExtensions.AsNoTracking <T>(Queryable.Where <T>((IQueryable <T>) this.EFContext.Set <T>(), predicate)); int recordCount = Queryable.Count <T>(q); List <T> data = Enumerable.ToList <T>((IEnumerable <T>)Queryable.Take <T>(Queryable.Skip <T>(DynamicQueryable.SingleOrderBy <T>(q, sortProperty, ascending), (pageIndex - 1) * pageSize), pageSize)); return(new Tuple <int, IList <T> >(recordCount, (IList <T>)data)); }
public virtual IList <T> FindPagenatedTreeList <K>(int pageIndex, int pageSize, Expression <Func <T, IEnumerable <IEnumerable <IList <T> > > > > including, Expression <Func <T, bool> > predicate, string sortProperty, bool ascending = true) { IQueryable <T> q = QueryableExtensions.AsNoTracking <T>(Queryable.Where <T>(QueryableExtensions.Include <T, IEnumerable <IEnumerable <IList <T> > > >((IQueryable <T>) this.EFContext.Set <T>(), including), predicate)); return(Enumerable.ToList <T>((IEnumerable <T>)Queryable.Take <T>(Queryable.Skip <T>(DynamicQueryable.SingleOrderBy <T>(q, sortProperty, ascending), (pageIndex - 1) * pageSize), pageSize))); }