Exemplo n.º 1
0
 public IEnumerable <Song> GetAllSongs(bool includeAlbum = false)
 {
     if (includeAlbum)
     {
         return(context.Set <Song>().Include(x => x.Album).AsNoTracking().ToList());
     }
     else
     {
         return(context.Song.ToList());
     }
 }
Exemplo n.º 2
0
 public Album GetAlbumById(int Id, bool includeSongs = false)
 {
     if (includeSongs)
     {
         return(context.Set <Album>().Include(x => x.SongList).AsNoTracking().FirstOrDefault(x => x.AlbumId == Id));
     }
     else
     {
         return(context.Album.FirstOrDefault(x => x.AlbumId == Id));
     }
 }