Ejemplo n.º 1
0
        public async virtual Task <IEnumerable <TModel> > FindAllAsync(PagingDetail pagingDetail)
        {
            if (pagingDetail.PageSize <= 0 || pagingDetail.PageNumber < 0)
            {
                return(new List <TModel>());
            }

            var results = dbContext.Set <TModel>().Skip((pagingDetail.PageNumber * pagingDetail.PageSize) - pagingDetail.PageSize);

            results = results.Take(pagingDetail.PageSize);

            return(await results.ToListAsync());
        }
Ejemplo n.º 2
0
        public virtual IEnumerable <TModel> FindAll(PagingDetail pagingDetail)
        {
            if (pagingDetail.PageSize <= 0 || pagingDetail.PageNumber < 0)
            {
                return(new List <TModel>());
            }

            var results = dbContext.Set <TModel>().Skip((pagingDetail.PageNumber * pagingDetail.PageSize) - pagingDetail.PageSize);

            results = results.Take(pagingDetail.PageSize);

            return(results.ToList());
        }