public async Task <IEnumerable <Album> > GetAlbumsByGenre(Guid genreId)
        {
            IQueryable <Album> query = _context.Set <Album>();

            var result = query.Where(album => album.GenreId == genreId);

            return(await result.ToListAsync());
        }
Beispiel #2
0
        public async Task <Album> GetAlbumAsync(Guid albumId)
        {
            IQueryable <Album> query = _context.Set <Album>();

            //// Build Query
            var result = query.Include(a => a.Track)
                         .Where(a => a.Id == albumId);

            //// execute query and return the result
            return(await result.FirstOrDefaultAsync());
        }
Beispiel #3
0
        public async Task <IEnumerable <Album> > GetAlbumsByArtistAsync(Guid artistId)
        {
            IQueryable <Album> query = _context.Set <Album>();

            var result = query.Where(a => a.ArtistId == artistId);

            return(await result.ToListAsync());
        }