Exemple #1
0
 /// <summary>
 /// Returns an enumerable collection of products.
 /// </summary>
 /// <param name="filter">Repository filter.</param>
 /// <param name="classNames">Class names of products to retrieve.</param>
 public IEnumerable <SKUTreeNode> GetProducts(IRepositoryFilter filter, params string[] classNames)
 {
     return(pageRetriever.Retrieve <TreeNode>(
                query => query
                .WhereIn("ClassName", classNames)
                .Where(filter?.GetWhereCondition())
                .WhereTrue("SKUEnabled")
                .FilterDuplicates(),
                cache => cache
                .Key($"{nameof(KenticoProductRepository)}|{nameof(GetProducts)}|{filter?.GetCacheKey()}|{string.Join(";", classNames)}")
                .Dependencies((_, builder) => builder.ObjectType("ecommerce.sku")))
            .Select(page => page as SKUTreeNode));
 }
 public IEnumerable <Coffee> GetCoffees(IRepositoryFilter filter, int count = 0)
 {
     return(CoffeeProvider.GetCoffees()
            .LatestVersion(mLatestVersionEnabled)
            .Published(!mLatestVersionEnabled)
            .OnSite(AppConfig.SiteName)
            .Culture(mCultureName)
            .CombineWithDefaultCulture()
            .TopN(count)
            .WhereTrue("SKUEnabled")
            .Where(filter?.GetWhereCondition())
            .OrderByDescending("SKUInStoreFrom")
            .ToList());
 }
Exemple #3
0
 /// <summary>
 /// Returns an enumerable collection of brewers ordered by the date of publication.
 /// </summary>
 /// <param name="filter">Repository filter.</param>
 /// <param name="count">The number of brewers to return. Use 0 as value to return all records.</param>
 public IEnumerable <Brewer> GetBrewers(IRepositoryFilter filter, int count = 0)
 {
     return(pageRetriever.Retrieve <Brewer>(
                query => query
                .TopN(count)
                .WhereTrue("SKUEnabled")
                .Where(filter?.GetWhereCondition())
                .FilterDuplicates()
                .OrderByDescending("SKUInStoreFrom"),
                cache => cache
                .Key($"{nameof(BrewerRepository)}|{nameof(GetBrewers)}|{filter?.GetCacheKey()}|{count}")
                // Include dependency on all pages of this type to flush cache when a new page is created.
                .Dependencies((_, builder) => builder.Pages(Brewer.CLASS_NAME).ObjectType("ecommerce.sku"))));
 }
 public IEnumerable <Brewer> GetBrewers(IRepositoryFilter filter, int count = 0)
 {
     return(BrewerProvider.GetBrewers()
            .LatestVersion(mLatestVersionEnabled)
            .Published(!mLatestVersionEnabled)
            .OnSite(SiteContext.CurrentSiteName)
            .Culture(mCultureName)
            .CombineWithDefaultCulture()
            .TopN(count)
            .WhereTrue("SKUEnabled")
            .Where(filter?.GetWhereCondition())
            .OrderByDescending("SKUInStoreFrom")
            .ToList());
 }