public async Task <(IEnumerable <Product> products, long totalRecords, int totalPages)> GetAll(RequestParameters pagefilter) { var collection = _context.GetCollection <Product>(nameof(_context.Products)); var results = await collection.AggregateByPage( Builders <Product> .Filter.Empty, Builders <Product> .Sort.Ascending(x => x.Id), page : pagefilter.PageNumber, pageSize : pagefilter.PageSize); return(results); }
public RepositoryBase(ICatalogDbContext catalogContext) { _context = catalogContext ?? throw new ArgumentNullException(nameof(catalogContext)); _dbCollection = _context.GetCollection <T>(typeof(T).Name); }