public StoreLiquidResult GetCategoryPage(PageDesign pageDesign, Category category, String type)
        {
            var dic = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, "");
            try
            {
                var contentCategory = new CategoryLiquid(category, type);

                object anonymousObject = new
                {
                    category = LiquidAnonymousObject.GetCategory(contentCategory)
                };

                var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, anonymousObject);
                dic[StoreConstants.PageOutput] = indexPageOutput;
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "GetCategoriesPartial");
            }

            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }
Beispiel #2
0
        public static object GetCategory(CategoryLiquid productCategories)
        {
            object anonymousObject = new
            {
                CategoryId  = productCategories.Category.Id,
                Name        = productCategories.Category.Name,
                Description = productCategories.Category.Description
            };

            return(anonymousObject);
        }
Beispiel #3
0
        public StoreLiquidResult GetContentsIndexPage(
            StorePagedList <Content> contents,
            PageDesign pageDesign,
            List <Category> categories, String type)
        {
            var items = new List <ContentLiquid>();
            var cats  = new List <CategoryLiquid>();

            foreach (var item in contents.items)
            {
                var category = categories.FirstOrDefault(r => r.Id == item.CategoryId);
                if (category != null)
                {
                    var blog = new ContentLiquid(item, category, type, ImageWidth, ImageHeight);
                    items.Add(blog);
                }
            }
            foreach (var category in categories)
            {
                var catLiquid = new CategoryLiquid(category, type);
                catLiquid.Count = contents.items.Count(r => r.CategoryId == category.Id);
                cats.Add(catLiquid);
            }

            var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, new
            {
                items      = LiquidAnonymousObject.GetContentLiquid(items),
                categories = LiquidAnonymousObject.GetCategoriesLiquid(cats)
            }
                                                                );


            var dic = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, indexPageOutput);
            dic.Add(StoreConstants.PageSize, contents.pageSize.ToStr());
            dic.Add(StoreConstants.PageNumber, contents.page.ToStr());
            dic.Add(StoreConstants.TotalItemCount, contents.totalItemCount.ToStr());
            //dic.Add(StoreConstants.IsPagingUp, pageDesign.IsPagingUp ? Boolean.TrueString : Boolean.FalseString);
            //dic.Add(StoreConstants.IsPagingDown, pageDesign.IsPagingDown ? Boolean.TrueString : Boolean.FalseString);

            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }