public void SetPermission(SetPermissionInput input)
        {
            //选中的模块权限
            var oldModulePermissionList = _roleModulePermissionRepository.GetAll().Where(t => t.RoleId == input.RoleId && t.IsDeleted == false)
                                          .Select(t => new RoleModulePermissionModel
            {
                RoleId       = t.RoleId,
                ModuleId     = t.ModuleId,
                PermissionId = t.PermissionId
            }).ToList();

            var newModulePermissionList    = JsonConvert.DeserializeObject <List <RoleModulePermissionModel> >(input.MewModulePermission);
            var sameModulePermissionList   = oldModulePermissionList.Intersect(newModulePermissionList);
            var addModulePermissionList    = newModulePermissionList.Except(sameModulePermissionList);
            var removeModulePermissionList = oldModulePermissionList.Except(sameModulePermissionList);

            this.SetRoleModulePermission(input.RoleId, addModulePermissionList, removeModulePermissionList);
        }
        public JsonResult SetPermission(int roleId, string isSet, string newModulePermission)
        {

            if (isSet == "0")
            {
                return Json(0, JsonRequestBehavior.AllowGet);
            }
            else
            {
                var input = new SetPermissionInput() { RoleId = roleId, IsSet = isSet, MewModulePermission = newModulePermission };
                _roleService.SetPermission(input);
            }
            return Json(1, JsonRequestBehavior.AllowGet);
        }
        public void SetPermission(SetPermissionInput input)
        {
            //选中的模块权限
            var oldModulePermissionList = _roleModulePermissionRepository.GetAll().Where(t => t.RoleId == input.RoleId && t.IsDeleted == false)
                                                .Select(t => new RoleModulePermissionModel
                                                {
                                                    RoleId = t.RoleId,
                                                    ModuleId = t.ModuleId,
                                                    PermissionId = t.PermissionId
                                                }).ToList();

            var newModulePermissionList = JsonConvert.DeserializeObject<List<RoleModulePermissionModel>>(input.MewModulePermission);
            var sameModulePermissionList = oldModulePermissionList.Intersect(newModulePermissionList);
            var addModulePermissionList = newModulePermissionList.Except(sameModulePermissionList);
            var removeModulePermissionList = oldModulePermissionList.Except(sameModulePermissionList);

            this.SetRoleModulePermission(input.RoleId, addModulePermissionList, removeModulePermissionList);
        }