public async Task <GenreViewModel> GetGenreByIdAsync(int id, CancellationToken ct = default(CancellationToken)) { var genreViewModel = GenreCoverter.Convert(await _genreRepository.GetByIdAsync(id, ct)); genreViewModel.Tracks = await GetTrackByGenreIdAsync(genreViewModel.GenreId, ct); return(genreViewModel); }
public async Task <List <GenreViewModel> > GetAllGenreAsync(CancellationToken ct = default(CancellationToken)) { var genres = GenreCoverter.ConvertList(await _genreRepository.GetAllAsync(ct)); foreach (var genre in genres) { genre.Tracks = await GetTrackByGenreIdAsync(genre.GenreId, ct); } return(genres.ToList()); }
public async Task <List <GenreViewModel> > GetAllGenreAsync(CancellationToken ct = default(CancellationToken)) { var genres = GenreCoverter.ConvertList(await _genreRepository.GetAllAsync(ct)); return(genres); }