public static IList<ProductItem> GetProducts(this Catalogue catalog, ProductsFilter filter) { return CatalogService.GetProducts(catalog, filter); }
public IList<ProductItem> GetProducts(Catalogue catalog, ProductsFilter filter) { if (filter == null) throw new FilterNotSetException(); var catalogRepository = GetCatalogRepository(catalog); using (IDocumentSession session = catalogRepository.OpenSession()) { var products = session.Query<ProductItem>() .Where(p => p.CatalogueId == catalog.Id) .Skip(filter.MaxPageSize * (filter.PageNumber -1)) .Take(filter.MaxPageSize) .ToList(); return products; } }