コード例 #1
0
        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);
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        public async Task <List <GenreViewModel> > GetAllGenreAsync(CancellationToken ct = default(CancellationToken))
        {
            var genres = GenreCoverter.ConvertList(await _genreRepository.GetAllAsync(ct));

            return(genres);
        }