public async Task <IEnumerable <GenreModel> > ExecuteAsync(GetGenresQuery query)
            {
                var genres = (await _genres.GetListAsync())
                             .Select(g => new GenreModel
                {
                    GenreId = g.Id,
                    Name    = g.Name
                });

                return(genres);
            }
        protected override Task <List <GenreDto> > RunQueryAsync(GetGenresQuery query)
        {
            var genresRaw = _dbContext.Genre;

            var genresResult = new List <GenreDto>();

            foreach (var genre in genresRaw)
            {
                genresResult.Add(GenreDto.Create(genre.Id, genre.Name));
            }

            return(Task.FromResult(genresResult));
        }
Esempio n. 3
0
        public async Task <List <Genre> > Handle(GetGenresQuery request, CancellationToken cancellationToken)
        {
            List <Genre> List = await _context.Genres.ToListAsync(cancellationToken);

            return(List);
        }
 public async Task <IList <GenreReadModel> > Handle(GetGenresQuery request, CancellationToken cancellationToken)
 {
     return(await _collection.Find(FilterDefinition <GenreReadModel> .Empty).ToListAsync(cancellationToken));
 }