Beispiel #1
0
        public ActionResult ShowRoleToUser(string id)
        {
            //TODO:一个razor页面如何操作多个复杂类型
            Guid uerid = Guid.Empty;

            if (string.IsNullOrEmpty(id) || !Guid.TryParse(id, out uerid))
            {
                this.RedirectToAction("Index", "Home", new { message = "传入id为空或有误,请检查" });
            }

            UserInfoService userInfoService = new UserInfoService();
            SysRoleServices sysRoleServices = new SysRoleServices();
            var             userRole        = userInfoService.ExecuteQuertRoleOfUser(uerid);
            var             allRole         = sysRoleServices.GetRole();

            foreach (var item in userRole)
            {
                allRole.Where(t => t.Id == item.Id).First().State = true;
            }
            //未完成:如何过滤存在情况
            ViewBag.AllRole = allRole;
            return(View(userRole));
        }
Beispiel #2
0
        public ActionResult RoleIndex()
        {
            SysRoleServices sysRoleServices = new SysRoleServices();

            return(View(sysRoleServices.GetRole()));
        }