public async Task <List <FreightRegisterModel> > GetFreightsRegisterByTruckerId(int truckerId) { var channel = GrpcChannel.ForAddress("https://localhost:5003"); try { var client = new Greeter.GreeterClient(channel); var request = new GetFreightsRegisterByTruckerIdRequest(); request.TruckerId = truckerId; var response = await client.GetFreightsRegisterByTruckerIdAsync(request); var freights = response.FreightRegisters.Select(s => new FreightRegisterModel() { Id = s.Id, TruckerId = s.TruckerId, FreightId = s.FreightId, Payment = s.Payment, Status = s.Status }).ToList(); return(freights); } finally { await channel.ShutdownAsync(); } }