/// <summary> /// 新增一个权限信息 HttpGet /// </summary> /// <returns></returns> public ViewResult Edit(string Id, bool isEdit = false) { RoleInfo model = roleInfoService.GetEntities(u => u.ID == Id).FirstOrDefault(); if (model == null) { RedirectToAction("Index"); } ViewBag.isEdit = isEdit; return(View(model)); }
public ActionResult SetRole() { int id = int.Parse(Request["id"]); var userData = userInfoService.GetEntities(u => u.Id == id && u.DelFlag == 0).Select(u => new { u.Id, u.UserName, u.SubTime, u.RoleInfo }).FirstOrDefault(); var userData2 = userInfoService.GetEntities(u => u.Id == id && u.DelFlag == 0).Select(u => new { u.Id, u.UserName, u.SubTime, }).FirstOrDefault(); var roleData = roleInfoService.GetEntities(r => r.DelFlag == DelFlag).Select(r => new { r.Id, r.RoleName }).ToList(); var exitsRole = (from r in userData.RoleInfo select r.Id).ToList(); return(Json(new { user = userData2, role = roleData, exRole = exitsRole }, JsonRequestBehavior.AllowGet)); }
//获取设置用户权限的界面 public ActionResult SetRoleUI(string id) { UserInfo model = userInfoService.GetEntities(u => u.ID == id).FirstOrDefault(); if (model == null) { TempData["ErrMsg"] = "未查找到当前用户"; return(Content("error")); } ViewBag.AllRoles = roleInfoService.GetEntities(u => true).ToList(); ViewBag.ExistRoles = (from r in model.RoleInfo select r.ID).ToList(); return(PartialView(model)); }
// GET: RoleInfo/Edit/5 public ActionResult Edit(int id) { ViewData.Model = roleInfoService.GetEntities(r => r.Id == id).FirstOrDefault(); return(View()); }