public async Task <List <FreightRegisterModel> > GetFreights() { var channel = GrpcChannel.ForAddress("https://localhost:5003"); try { var client = new Greeter.GreeterClient(channel); var request = new GetFreightsRegisterRequest(); var response = await client.GetFreightsAsync(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(); } }