示例#1
0
        private async Task Delete(bool error = false)
        {
            if (error)
            {
                Error();
            }

            Console.WriteLine("    Delete    ");
            Console.WriteLine("++++++++++++++");
            Console.WriteLine("");
            Console.WriteLine("Enter ID of agent to delete:");
            var input = Console.ReadLine();

            if (int.TryParse(input, out int id))
            {
                var request = new DeleteAgentRequest {
                    Id = id
                };
                var channel = GrpcChannel.ForAddress("https://localhost:5001");
                var client  = new AgentManagerService.AgentManagerServiceClient(channel);
                var reply   = await client.DeleteAsync(request);
                await PrintResults(reply.Response);
            }
            else
            {
                await Delete(true);
            }
        }