Esempio n. 1
0
        public ActionResult Edit(CustomPermissionsModel model)
        {
            if (ModelState.IsValid)
            {
                if (customPermissionsService.AlreadyExists(model.Name, model.MenuId, model.Id))
                {
                    ModelState.AddModelError("Name", "自定义权限名重复");
                }
                else
                {
                    var customPermission = customPermissionsService.Get(model.Id);
                    //忽略更新
                    model.CreateDate = customPermission.CreateDate;
                    model.MenuId     = customPermission.MenuId;

                    customPermission = model.ToEntity(customPermission);
                    customPermissionsService.Modify(customPermission);
                    return(Json(new AjaxResult()
                    {
                        Result = Result.Success
                    }));
                }
            }
            return(View(model));
        }
Esempio n. 2
0
 public ActionResult Create(CustomPermissionsModel model)
 {
     if (ModelState.IsValid)
     {
         if (customPermissionsService.AlreadyExists(model.Name, model.MenuId, Guid.Empty))
         {
             ModelState.AddModelError("Name", "权限名重复");
         }
         else
         {
             customPermissionsService.Add(model.ToEntity());
             return(Json(new AjaxResult()
             {
                 Result = Result.Success
             }));
         }
     }
     return(View(model));
 }