Exemplo n.º 1
0
        protected List <WebsiteMenuModel> GetSubMenuOrdered(bool isMenu, bool isFooter, bool isSitemap, int parentID, bool includeArticles = false, bool includeCategory = false, bool includeProducts = false)
        {
            List <tbl_SiteMap> sitemaps = WebContentService.GetSitemapByContentType(ContentType.Content, this.DomainID)
                                          .Where(sm => (isMenu && sm.SM_Menu) || (isFooter && sm.SM_Footer) || (isSitemap && sm.SM_Sitemap)).ToList();

            if (includeArticles)
            {
                sitemaps.AddRange(WebContentService.GetSitemapByContentType(ContentType.Blog, this.DomainID).Where(b => b.SM_Live).OrderByDescending(b => b.SM_Date));
            }
            if (includeCategory)
            {
                sitemaps.AddRange(WebContentService.GetSitemapByContentType(ContentType.Category, this.DomainID).Where(c => c.tbl_ProdCategories.PC_Live && (!isMenu || c.SM_Menu)));
            }
            if (includeProducts)
            {
                sitemaps.AddRange(WebContentService.GetSitemapByContentType(ContentType.Product, this.DomainID).Where(p => p.tbl_Products.P_Live));
            }

            return(CreateChildMenuOrdered(sitemaps, 0));
        }