public override Task <RemoveResponse> RemoveOperate(RemoveRequest request, ServerCallContext context)
        {
            var response = new RemoveResponse();

            try
            {
                _operate.Delete(request.Id);
                response.IsComplete = true;
                return(Task.FromResult(response));
            }
            catch
            {
                response.IsComplete = false;
                return(Task.FromResult(response));
            }
        }
Esempio n. 2
0
        public override Task <RemoveResponse> RemoveRole(RemoveRequest request, ServerCallContext context)
        {
            var response = new RemoveResponse();

            if (request.Id == 1)
            {
                throw new RpcException(new Status(StatusCode.InvalidArgument, "管理员角色不能被删除"));
            }
            try
            {
                _role.Delete(request.Id);
                response.IsComplete = true;
                return(Task.FromResult(response));
            }
            catch
            {
                response.IsComplete = false;
                return(Task.FromResult(response));
            }
        }