コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
 public ActionResult Edit(ShadowAuthModel model, int Id)
 {
     var auth = model.ToAuthAction();
     auth.AuthorizeId = Id;
     AuthManager.UpdateAuth(auth, model.AuthRole);
     return RedirectToAction("Index");
 }