Пример #1
0
 public async Task<Products> GetProductsForCategoryAsync(Category category, PagingOptions options)
 {
     using (var log = RequestLogger.Current.BeginJungoLog(this))
     {
         try
         {
             var uri = Billboard.ResolvePagingOptions(category.Products.Uri, options);
             var prodResponse = await Client.GetCacheableAsync<ProductsResponse>(uri).ConfigureAwait(false);
             if (prodResponse == null) return null;
             var catProds = prodResponse.Products;
             catProds.Product = (await GetProductsAsync(catProds.Product).ConfigureAwait(false)).ToArray();
             return catProds;
         }
         catch (Exception exc)
         {
             throw log.LogException(exc);
         }
     }
 }
        private CategoryViewModel CreateCategoryViewModel(Category category, long? parentCategoryId)
        {
            if (category == null) return null;

            return new CategoryViewModel
            {
                CategoryId = category.Id,
                DisplayName = category.DisplayName,
                Image = category.ThumbnailImage,
                ParentCategoryId = parentCategoryId,
                //Keywords = category.Keywords,
                Attributes = category.CustomAttributes
            };
        }