public IEnumerable <Song> GetAllSongs(bool includeAlbum = false) { if (includeAlbum) { return(context.Set <Song>().Include(x => x.Album).AsNoTracking().ToList()); } else { return(context.Song.ToList()); } }
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)); } }