public async Task <IActionResult> Index() { ViewBag.User = this.UserIdentity; //读取左侧菜单 var resources = await _resourceService.GetLeftTreeAsync(UserIdentity.UserId); if (resources.Any()) { //获取消息 var messagePage = await _messageService.MyListAsync(new OaMessageMyListSearch() { IsDel = 0, IsRead = 0, PageIndex = 1, PageSize = 10, UserId = UserIdentity.UserId }); ViewBag.MessagePage = messagePage; //读取该用户全部操作权限并缓存 await _permissionStorage.InitAsync(); return(View(resources)); } else { return(Redirect("/error/nomenu")); } }
public async Task <IViewComponentResult> InvokeAsync() { var user = HttpContext.User.ToUserIdentity(); ViewBag.User = user; var resources = await _resourceService.GetLeftTreeAsync(user.UserId); if (resources.Any()) { //读取该用户全部操作权限并缓存 await _permissionStorage.InitAsync(); return(View(resources)); } else { return(View(new List <ResourceTreeViewModel>())); } }
public async Task <IActionResult> Index() { SysUser user = HttpContext.Session.User(); ViewBag.User = user; //读取左侧菜单 var resources = await _resourceService.GetLeftTreeAsync(user.UserId); if (resources.Any()) { //读取该用户全部操作权限并缓存 await _permissionStorage.InitAsync(); return(View(resources)); } else { return(Redirect("/error/nomenu")); } }