public ProductPaging GetPagingProduct(int pageIndex, int pageSize) { var Products = ProductsRepository.GetMany(x => !x.isDelete); var pager = new Pager(Products.Count(), pageIndex, pageSize); var productPaging = new ProductPaging { Items = Products.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize), Pager = pager }; return(productPaging); }
public ProductPaging GetPagingProduct(int pageIndex, int pageSize, int categoryId) { var Products = _productsRepository.GetMany(x=>!x.isDelete); if (categoryId != 0) { Products = Products.Where(x => x.ProductCategoryId == categoryId); } var pager = new Pager(Products.Count(), pageIndex,pageSize); var productPaging = new ProductPaging { Items = Products.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize), Pager = pager }; return productPaging; }