示例#1
0
        //删除权限
        public JsonResult DeleteRight(int id)
        {
            SysPermission deleteRight = AllPermissions.First(p => p.PermissionId == id);

            if (deleteRight.ParentId == 0)
            {
                return(Json(new
                {
                    result = 0,
                    content = RetechWing.LanguageResources.Right.NotDeleteRootRight
                }, JsonRequestBehavior.AllowGet));
            }

            try
            {
                _permissionManager.DeletePermission(id);
                RefreshRightCache();
                return(Json(new
                {
                    result = 1,
                    content = RetechWing.LanguageResources.Common.DeleteSuccess
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    result = 0,
                    content = RetechWing.LanguageResources.Common.DeleteFailed + ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }