public override async Task GetPersons(PersonsRequest request, IServerStreamWriter <PersonResponse> responseStream, ServerCallContext context) { List <PersonResponse> persons = new List <PersonResponse> { new PersonResponse { UserId = 1, FirstName = "James", LastName = "Pickup", IsVerified = true }, new PersonResponse { UserId = 2, FirstName = "Cherry", LastName = "Coder91", IsVerified = true }, new PersonResponse { UserId = 3, FirstName = "Mr", LastName = "Developer", IsVerified = false } }; foreach (var person in persons) { await responseStream.WriteAsync(person); await Task.Delay(2000); // Artiftical delay to demonstrate streaming more clearly in the client. Not a production concept! } }
public async Task <IActionResult> GetPerson([FromQuery] PersonsRequest request) { var presenter = new PersonsPresenter(); var resultado = await _personsUseCase.ExecuteAsync(request); presenter.OnPopulate(resultado); return(presenter.ViewModel); }