Exemple #1
0
 public HtmlString GetMenuClass(TopMenuDto dto)
 {
     if (dto.Activity)
     {
         return(new HtmlString("class=\"layui-this\""));
     }
     return(null);
 }
        public async Task <IViewComponentResult> InvokeAsync()
        {
            if (_signInManager.IsSignedIn((ClaimsPrincipal)User))
            {
                string identityId = _signInManager.UserManager.GetUserId((ClaimsPrincipal)User);

                var model = new TopMenuDto
                {
                    IsSignedIn = true,
                    Name       = await _userInformation.GetUserFirstNameAsync(identityId)
                };
                return(View(model));
            }

            return(View(new TopMenuDto
            {
                IsSignedIn = false,
                Name = ""
            }));
        }
        public async Task <IActionResult> OnGetAsync(string code = null)
        {
            TopMenus = new List <TopMenuDto>();
            var topMenus = await _adminApplication.GetTopMenu(AdminDto.Id);

            foreach (var item in topMenus)
            {
                TopMenus.Add(new TopMenuDto(item, code));
            }
            var logoDto = await _adminApplication.GetSettingValueByCode("Logo");

            if (logoDto != null)
            {
                Logo = logoDto.Value;
            }
            TopMenuDto topmenu = TopMenus.FirstOrDefault(q => q.Activity);

            if (string.IsNullOrEmpty(code))
            {
                var f = TopMenus.FirstOrDefault(q => q.Code == "SqlOnlineDesktop");
                if (f != null)
                {
                    return(Redirect("/sqls"));
                }
                if (topmenu == null && TopMenus.Count > 0)
                {
                    topmenu = TopMenus[0];
                }
            }
            if (topmenu != null)
            {
                TreeMenuDto = new TreeAdminMenuDto();
                if (topmenu != null)
                {
                    topmenu.Activity = true;
                    TreeMenuDto      = await _adminApplication.GetSidebarMenu(AdminDto.Id, topmenu.Id, topmenu.Ids);
                }
            }
            ViewData["Title"] = "基础配置";
            return(Page());
        }