Exemplo n.º 1
0
 public static IList<ProductItem> GetProducts(this Catalogue catalog, ProductsFilter filter) { return CatalogService.GetProducts(catalog, filter); }
Exemplo n.º 2
0
 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;
     }
 }