Exemplo n.º 1
0
        public async Task <IActionResult> Get([FromServices] IHandle <GetExampleCollecionRequest, CollectionResponse <ExampleResponse> > handle)
        {
            var request  = new GetExampleCollecionRequest();
            var response = await handle.HandleAsync(request);

            return(Ok(response));
        }
        public async Task <CollectionResponse <ExampleResponse> > HandleAsync(GetExampleCollecionRequest request)
        {
            var collecion = await _repository.GetCollecionAsync();

            var response = collecion
                           .Select(example => example.ToResponse())
                           .ToCollecionResponse();

            return(response);
        }