Beispiel #1
0
        public StoreLiquidResult GetRelatedContentsPartial(Category category, List <Content> contents, PageDesign pageDesign, String type)
        {
            var items = new List <ContentLiquid>();

            foreach (var item in contents)
            {
                var blog = new ContentLiquid(item, category, type, ImageWidth, ImageHeight);
                items.Add(blog);
            }

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


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

            dic.Add(StoreConstants.PageOutput, indexPageOutput);


            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }
Beispiel #2
0
        public StoreLiquidResult GetContentsByContentType(List <Content> contents, List <Category> categories, PageDesign pageDesign, string type)
        {
            var items = new List <ContentLiquid>();

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

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


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

            dic.Add(StoreConstants.PageOutput, indexPageOutput);


            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }
Beispiel #3
0
        public static object GetContentAnonymousObject(ContentLiquid contentLiquid)
        {
            object anonymousObject = new
            {
                CategoryId          = contentLiquid.Content.CategoryId,
                CategoryName        = contentLiquid.Category.Name,
                CategoryDescription = contentLiquid.Category.Description,
                ContentId           = contentLiquid.Content.Id,
                Name        = contentLiquid.Content.Name,
                Description = contentLiquid.Content.Description,
                contentLiquid.Content.VideoUrl,
                images = contentLiquid.ImageLiquid,
            };

            return(anonymousObject);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        public StoreLiquidResult GetContentDetailPage(Content content, PageDesign pageDesign, Category category, String type)
        {
            var items         = new List <ContentLiquid>();
            var contentLiquid = new ContentLiquid(content, category, type, ImageWidth, ImageHeight);

            var anonymousObject = LiquidAnonymousObject.GetContentAnonymousObject(contentLiquid);

            var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, anonymousObject);



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

            dic.Add(StoreConstants.PageOutput, indexPageOutput);


            var result = new StoreLiquidResult();

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