Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public PublicResult SetIsActive(SetIsActiveRoleDto dto)
        {
            using (var client = DbFactory.CreateClient())
            {
                var role = client.Queryable <Role>().InSingle(dto.Id);
                if (role == null)
                {
                    return(Error("找不到该条信息"));
                }

                if (role.IsSystem)
                {
                    return(Error("内置用户不能删除"));
                }

                client.Updateable <Role>()
                .SetColumns(it => new Role()
                {
                    IsActive = !it.IsActive
                })
                .Where(it => it.Id == dto.Id)
                .ExecuteCommand();
            }
            _distributedCache.Remove(PermissionService.CACHE_ROLE_PERMISSION_ALL_KEY);
            _distributedCache.Remove(CACHE_ROLE_ALL_KEY);
            return(Ok());
        }
Beispiel #2
0
        public IActionResult SetIsActive(SetIsActiveRoleDto dto)
        {
            var result = _roleService.SetIsActive(dto);

            return(Json(result));
        }