public ActionResult Add(ShadowAuthModel model) { JsonResultModel result = new JsonResultModel(); if (!(result.IsSuccess = ModelState.IsValid)) { result.Message = ModelState.ToErrorString(); return Json(result); } AuthManager.AddAuth(model.ToAuthAction(), model.AuthRole); result.Message = "成功!"; return Json(result); }
public ActionResult Edit(int Id) { var auth = AuthManager.GetAuth(Id); if (auth == null) PageNotFound(); var authRoles = AuthManager.GetAuthRoles(Id); ViewBag.Roles = EnumHelper.ToMultiSelectList<Role>(it => authRoles.Contains(it), it => it.ToString(), it => it.ToString()); var model = new ShadowAuthModel { Name = auth.Name, Controller = auth.Controller, Action = auth.Action, MethodSign = auth.MethodSign, DefaultState = auth.DefaultState }; return View(model); }
public ActionResult Edit(ShadowAuthModel model, int Id) { var auth = model.ToAuthAction(); auth.AuthorizeId = Id; AuthManager.UpdateAuth(auth, model.AuthRole); return RedirectToAction("Index"); }