public async Task <ExampleGetAllResponse> GetAllAsync() => await ExecuteAsync(async() =>
 {
     var response = new ExampleGetAllResponse();
     var banco    = await _exampleRepository.GetAllAsync().ConfigureAwait(false);
     response.Itens.AddRange(banco.Select(x => (ExampleDto)x).ToList());
     return(response);
 });
Exemple #2
0
        public async Task <ActionResult> Get()
        {
            try
            {
                var examples = await exampleRepository.GetAllAsync();

                return(Ok(examples));
            }
            catch (Exception exception)
            {
                logger.LogError(exception, "Failed to get all Examples");
                return(StatusCode(StatusCodes.Status500InternalServerError, "Failed to retrieve examples"));
            }
        }
 public async Task <IEnumerable <ExampleViewModel> > Get(int?pageNumber, int pageSize)
 {
     return(_mapper.Map <IEnumerable <ExampleViewModel> >(await _exampleRepository.GetAllAsync(pageNumber, pageSize)));
 }
Exemple #4
0
 public async Task <IDataResult <List <Example> > > GetAllAsync()
 {
     return(new SuccessDataResult <List <Example> >(await _exampleRepository.GetAllAsync()));
 }