Пример #1
0
        protected override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            dynamic viewBag = base.ViewBag;

            //Get link sản phẩm
            IEnumerable <MenuLink> menuLinksProduct = _menuLinkService.FindBy((MenuLink x) =>
                                                                              x.Status == 1 &&
                                                                              x.VirtualId == "ca19fb4a-10a1-4515-bdb2-0c091b4107d5"
                                                                              , true);

            if (menuLinksProduct.Any <MenuLink>())
            {
                viewBag.objMenuLinkProduct = menuLinksProduct.ElementAt(0);
            }

            //Get link sản phẩm
            IEnumerable <MenuLink> menuLinksIntro = _menuLinkService.FindBy((MenuLink x) =>
                                                                            x.Status == 1 &&
                                                                            x.VirtualId == "5ff97ccf-29d4-47d2-82d9-9d217119a68d"
                                                                            , true);

            if (menuLinksIntro.Any <MenuLink>())
            {
                viewBag.objMenuLinkIntro = menuLinksIntro.ElementAt(0);
            }
        }
Пример #2
0
 protected override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     if (filterContext.RouteData.Values["action"].Equals("CreatePost"))
     {
         var menuLinks = _menuLinkService.FindBy(x => x.Status == 1 && x.TemplateType != 5 && x.TemplateType != 1, true);
         ViewBag.MenuList = menuLinks;
     }
     if (filterContext.RouteData.Values["action"].Equals("EditPost"))
     {
         var menuLinks1 = _menuLinkService.FindBy(x => x.Status == 1 && x.TemplateType != 5 && x.TemplateType != 1, true);
         ViewBag.MenuList = menuLinks1;
     }
 }
Пример #3
0
        public ActionResult GetStaticContentParent(int menuId, string title, string virtualId)
        {
            var breadCrumbs = new List <BreadCrumb>();
            var virtualIds  = virtualId.Split('/');

            var staticContent = _staticContentService.Get(x => x.MenuId == menuId && x.Status == 1);

            //Convert to localized
            var staticContentLocalized = staticContent.ToModel();

            var viewBag = ViewBag;

            var menuLinks = _menuLinkService.FindBy(x => x.Id == menuId && x.Status == 1);

            //Convert to localized
            menuLinks = menuLinks.Select(x => x.ToModel());

            if (menuLinks.IsAny())
            {
                viewBag.ListItems = menuLinks;
            }

            //var strArrays1 = virtualIds;
            for (var i = 0; i < virtualIds.Length; i++)
            {
                var item     = virtualIds[i];
                var menuLink = _menuLinkService.Get(x => x.CurrentVirtualId.Equals(item) && !x.MenuName.Equals(title));
                if (menuLink != null)
                {
                    breadCrumbs.Add(new BreadCrumb
                    {
                        Title   = menuLink.GetLocalized(x => x.MenuName, menuLink.Id),
                        Current = false,
                        Url     = Url.Action("GetContent", "Menu", new { area = "", menu = menuLink.SeoUrl })
                    });
                }
            }

            breadCrumbs.Add(new BreadCrumb
            {
                Current = true,
                Title   = staticContentLocalized.Title
            });

            ViewBag.TitleNews  = staticContentLocalized.Title;
            ViewBag.BreadCrumb = breadCrumbs;
            ViewBag.Title      = staticContentLocalized.Title;

            return(PartialView(staticContentLocalized));
        }
Пример #4
0
        public ActionResult GetCategorySearchBox()
        {
            var menuNavs  = new List <MenuNavViewModel>();
            var menuLinks = _menuLinkService.FindBy(x => x.Status == 1 && x.TemplateType == 2, true);

            if (menuLinks.Any())
            {
                var menuNav =
                    from x in menuLinks
                    select new MenuNavViewModel
                {
                    MenuId           = x.Id,
                    ParentId         = x.ParentId,
                    MenuName         = x.MenuName,
                    SeoUrl           = x.SeoUrl,
                    OrderDisplay     = x.OrderDisplay,
                    ImageUrl         = x.ImageBigSize,
                    CurrentVirtualId = x.CurrentVirtualId,
                    VirtualId        = x.VirtualId
                };
                menuNavs = CreateMenuNav(null, menuNav);
            }

            return(PartialView(menuNavs));
        }
Пример #5
0
 protected override void OnActionExecuted(ActionExecutedContext filterContext)
 {
     if (filterContext.RouteData.Values["action"].Equals("create") || filterContext.RouteData.Values["action"].Equals("edit") || filterContext.RouteData.Values["action"].ToString().ToLower().Equals("index"))
     {
         var menuLinks = _menuLinkService.FindBy(x => x.Status == 1 && x.TemplateType == 1 || x.TemplateType == 6 || x.TemplateType == 7, true);
         ViewBag.MenuList = menuLinks;
     }
 }
Пример #6
0
        protected override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            if (filterContext.RouteData.Values["action"].Equals("create") || filterContext.RouteData.Values["action"].Equals("edit"))
            {
                var menuLinks = _menuLinkService.FindBy(x => x.Status == (int)Status.Enable, true);
                ViewBag.MenuList = menuLinks;

                var pageBanners = _pageBannerService.FindBy(x => x.Status == (int)Status.Enable);
                ViewBag.PageBanners = pageBanners;
            }
        }
Пример #7
0
        public ActionResult Index()
        {
            var sitemapNodes = new List <SitemapNode>();
            var menuLinks    = _menuLinkService.FindBy(x => x.Status == 1, true);

            if (menuLinks.IsAny())
            {
                foreach (var menuLink in menuLinks)
                {
                    sitemapNodes.Add(new SitemapNode("Normal")
                    {
                        Url                  = Url.Action("GetContent", "Menu", new { menu = menuLink.SeoUrl }, Request.Url.Scheme),
                        ChangeFrequency      = ChangeFrequency.Daily,
                        Priority             = new decimal(8, 0, 0, false, 1),
                        LastModificationDate = (menuLink.UpdatedDate.HasValue ? menuLink.UpdatedDate.Value.ToString("yyyy-MM-dd") : string.Empty)
                    });
                }
            }

            return(_sitemapProvider.CreateSitemap(new SitemapModel(sitemapNodes)));
        }
Пример #8
0
        public ActionResult BreadCrumNews(string virtualId)
        {
            ViewBag.VirtualId = virtualId;
            var lstMenuLink = new List <MenuLink>();
            var menuLinks   = _menuLinkService.FindBy(x => x.TemplateType == (int)TemplateContent.News && x.Status == (int)Status.Enable, true);

            if (menuLinks.IsAny())
            {
                lstMenuLink.AddRange(menuLinks);
                ViewBag.TitleNews = menuLinks.ElementAt(0).MenuName;
            }

            return(PartialView(lstMenuLink));
        }
Пример #9
0
        public ActionResult GetMenuProduct(int?selected)
        {
            var menuNavs  = new List <MenuNav>();
            var menuLinks = _menuLinkService.FindBy(x => x.TemplateType == 2 || x.TemplateType == 8, true);

            if (menuLinks.Any())
            {
                var orderDisplay =
                    from x in menuLinks
                    orderby x.OrderDisplay descending
                    select new MenuNav
                {
                    MenuId   = x.Id,
                    ParentId = x.ParentId,
                    MenuName = x.MenuName
                };
                menuNavs = CreateMenuNav(null, orderDisplay);
            }
            ViewBag.Selected = selected;
            return(PartialView(menuNavs.ToList()));
        }
Пример #10
0
        public ActionResult GetTopMenu()
        {
            IEnumerable <MenuLink> menuLinks = _menuLinkService.FindBy((MenuLink x) => x.Status == 1 && x.Position == 1, true);

            //Convert to localized
            menuLinks = menuLinks.Select(x =>
            {
                return(x.ToModel());
            });

            List <MenuNavViewModel> menuNavs = new List <MenuNavViewModel>();

            if (menuLinks.Any <MenuLink>())
            {
                IEnumerable <MenuNavViewModel> menuNav =
                    from x in menuLinks
                    select new MenuNavViewModel()
                {
                    MenuId           = x.Id,
                    ParentId         = x.ParentId,
                    MenuName         = x.MenuName,
                    SeoUrl           = x.SeoUrl,
                    OtherLink        = x.SourceLink,
                    OrderDisplay     = x.OrderDisplay,
                    ImageUrl         = x.ImageUrl,
                    CurrentVirtualId = x.CurrentVirtualId,
                    VirtualId        = x.VirtualId,
                    TemplateType     = x.TemplateType,
                    IconNav          = x.Icon1,
                    IconBar          = x.Icon2
                };

                menuNavs = this.CreateMenuNav(null, menuNav);
            }

            return(base.PartialView(menuNavs));
        }