Ejemplo n.º 1
0
        public ActionResult SetRole(int id)
        {
            int      userid   = id;
            UserInfo userInfo = userInfoService.GetEntity(u => u.ID == userid).FirstOrDefault();

            //将所有角色传到cshtml
            ViewBag.AllRoles = roleInfoService.GetEntity(u => u.DelFlag == NoDel).ToList();
            //将所有关联角色传到cshtml
            //linq 语法
            if (userInfo != null)
            {
                ViewBag.ExitsRoles = (from r in userInfo.RoleInfo select r.ID).ToList();
            }
            return(View(userInfo));
        }
Ejemplo n.º 2
0
 public ActionResult Edit(int id)
 {
     ViewData.Model = roleInfoService.GetEntity(u => u.ID == id).FirstOrDefault();
     return(View());
 }