Exemplo n.º 1
0
 public ActionResult Add(PermissionAddNewModel model)
 {
     PermSvc.AddPermission(model.Name, model.Description);
     return(Json(new AjaxResult {
         status = "ok"
     }));
 }
Exemplo n.º 2
0
 //public ActionResult Add(string name,string description)
 //使用Model类的方式传递参数,可以使用MVC的校验
 public ActionResult Add(PermissionAddNewModel model)
 {
     PermSvc.AddPermission(model.Name, model.Description);
     //return RedirectToAction(nameof(List));
     //todo:要检查权限项名字不能重复
     return(Json(new AjaxResult {
         Status = "ok"
     }));
 }
Exemplo n.º 3
0
        public ActionResult Add(PermissionAddNewModel model)
        {
            var id = PermSvc.AddPermission(model.Name, model.Description);

            //return RedirectToAction("List");
            //todo
            return(Json(new AjaxResult {
                Status = "ok"
            }));
        }
Exemplo n.º 4
0
        public ActionResult Add(PermissionAddNewModel model)
        {
            var perm = permSvc.GetByName(model.Name);

            if (perm == null)
            {
                permSvc.AddPermission(model.Name, model.Description);
                return(Json(new AjaxResult {
                    Status = "ok"
                }));
            }
            else
            {
                return(Json(new AjaxResult {
                    ErrorMsg = "该权限已存在:" + model.Name
                }));
            }
        }
Exemplo n.º 5
0
        public ActionResult Add(PermissionAddNewModel model)
        {
            long permId = PermissionService.AddPermission(model.Name, model.Description);

            //todo:权限项名字不能重复
            if (permId != 0)
            {
                return(Json(new AjaxResult()
                {
                    Status = "ok"
                }));
            }
            else
            {
                return(Json(new AjaxResult()
                {
                    ErrorMsg = "添加失败"
                }));
            }
        }