コード例 #1
0
        public PartialViewResult Menu()
        {
            var user = CurrentUser;
            IEnumerable<NavigationItem> navItems = new List<NavigationItem>();
            var pages = RolePagesMap.Pages;
            navItems = navItems.Concat(RolePagesMap.CommonPages).Distinct();
            if (user.IsAlumni())
            {
                navItems = navItems.Concat(pages[UserRoleType.Alumni]);
            }
            if (user.IsStudent())
            {
                navItems = navItems.Concat(pages[UserRoleType.Student]);
            }
            if (user.IsAdmin())
            {
                navItems = navItems.Concat(pages[UserRoleType.Admin]);
            }

            var txtItems = navItems.Where(n => string.IsNullOrEmpty(n.ImageUrl));
            var imgItems = navItems.Where(n => !string.IsNullOrEmpty(n.ImageUrl));

            var vm = new NavigationVm
            {
                TextItems = txtItems,
                ImageItems = imgItems,
                SelectePage = CurrentPage,
            };
            return PartialView(vm);
        }
コード例 #2
0
        public PartialViewResult Mobile()
        {
            IEnumerable<NavigationItem> navItems = new List<NavigationItem>();
            var pages = RolePagesMap.CommonPages;
            navItems = navItems.Concat(pages);

            var txtItems = navItems.Where(n => string.IsNullOrEmpty(n.ImageUrl));
            var imgItems = navItems.Where(n => !string.IsNullOrEmpty(n.ImageUrl));

            var vm = new NavigationVm
            {
                TextItems = txtItems,
                ImageItems = imgItems,
                SelectePage = CurrentPage,
            };
            return PartialView(vm);
        }
コード例 #3
0
        public PartialViewResult Top()
        {
            IEnumerable<NavigationItem> navItems = new List<NavigationItem>();
            var pages = RolePagesMap.Pages;
            navItems = navItems.Concat(pages[UserRoleType.Guest]);

            var txtItems = navItems.Where(n => string.IsNullOrEmpty(n.ImageUrl));
            var imgItems = navItems.Where(n => !string.IsNullOrEmpty(n.ImageUrl));

            var vm = new NavigationVm
            {
                TextItems = txtItems,
                ImageItems = imgItems,
                SelectePage = CurrentPage,
            };
            return PartialView("Menu", vm);
        }