public async Task <TruckerModel> AddTrucker(TruckerModel truckerModel) { var channel = GrpcChannel.ForAddress("https://localhost:5003"); try { var client = new Greeter.GreeterClient(channel); var request = new AddTruckerRequest(); request.Trucker = new TruckerMessage(); request.Trucker.Username = truckerModel.Username; request.Trucker.Password = truckerModel.Password; request.Trucker.TruckingCompany = truckerModel.TruckingCompany; var response = await client.AddTruckerAsync(request); if (response.Trucker == null) { return(null); } var trucker = new TruckerModel() { Id = response.Trucker.Id, Username = response.Trucker.Username, TruckingCompany = response.Trucker.TruckingCompany }; return(trucker); } finally { await channel.ShutdownAsync(); } }