示例#1
0
 public async Task <PagedResult <ProductRepositoryModel> > GetProductsAsync(GetProductsRepositoryModel model)
 {
     //
     //  Note: Return copies of cached entities so they cannot be accidentally modified by consumers
     //
     return(await Task.FromResult(new PagedResult <ProductRepositoryModel>(_data.Skip(model.StartIndex).Take(model.MaxRecords).Select(o => new ProductRepositoryModel {
         Id = o.Id, MPN = o.MPN, Price = o.Price, Title = o.Title
     }), _data.Count)));
 }
        public async Task <PagedResult <ProductRepositoryModel> > GetProductsAsync(GetProductsRepositoryModel model)
        {
            var totalRecords = this._dbContext.Products.Count();

            return(await Task.FromResult(new PagedResult <ProductRepositoryModel>(this._dbContext.Products.Skip(model.StartIndex).Take(model.MaxRecords), totalRecords)));
        }