Пример #1
0
        public async Task <EasyPaging <TEntity> > FindAsync(Expression <Func <TEntity, bool> > predicate, int pageNumber = 1, int pageSize = 20)
        {
            var result = new EasyPaging <TEntity>(pageNumber, pageSize);
            var rows   = await FindAsync(predicate);

            result.Count = rows?.Count() ?? 0;
            result.Rows  = rows.Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList();
            return(result);
        }
Пример #2
0
        public virtual async Task <EasyPaging <TEntity> > FindAsync(Expression <Func <TEntity, bool> > predicate, int pageNumber = 1, int pageSize = 20)
        {
            var r    = new EasyPaging <TEntity>(pageNumber, pageSize);
            var list = await FindAsync(predicate);

            r.Count = list.Count;
            r.Rows  = list
                      ?.Skip((pageNumber - 1) * pageSize)
                      ?.Take(pageSize)
                      ?.ToList()
                      ?? new List <TEntity>();
            return(r);
        }