Пример #1
0
 public WCFWebServiceJson()
 {
     SqlAccountRepository = new SqlAccountRepository(ConnectionString);
     SqlAlbumRepository = new SqlAlbumRepository(ConnectionString);
     SqlAlbumGenreRepository = new SqlAlbumGenreRepository(ConnectionString);
     SqlAlbumSongRepository = new SqlAlbumSongRepository(ConnectionString);
     SqlArtistRepository = new SqlArtistRepository(ConnectionString);
     SqlArtistAlbumRepository = new SqlArtistAlbumRepository(ConnectionString);
     SqlArtistGenreRepository = new SqlArtistGenreRepository(ConnectionString);
     SqlBusinessTypeRepository = new SqlBusinessTypeRepository(ConnectionString);
     SqlBusinessUserRepository = new SqlBusinessUserRepository(ConnectionString);
     SqlCountyCityRepository = new SqlCountyCityRepository(ConnectionString);
     SqlGenreRepository = new SqlGenreRepository(ConnectionString);
     SqlMediaAssetFormatRepository = new SqlMediaAssetFormatRepository(ConnectionString);
     SqlMediaAssetLocationRepository = new SqlMediaAssetLocationRepository(ConnectionString);
     SqlMediaAssetRepository = new SqlMediaAssetRepository(ConnectionString);
     SqlMediaAssetTypeRepository = new SqlMediaAssetTypeRepository(ConnectionString);
     SqlPlaylistRepository = new SqlPlaylistRepository(ConnectionString);
     SqlPlaylistSongRepository = new SqlPlaylistSongRepository(ConnectionString);
     SqlProtocolRepository = new SqlProtocolRepository(ConnectionString);
     SqlPurchasedSongRepository = new SqlPurchasedSongRepository(ConnectionString);
     SqlSongRepository = new SqlSongRepository(ConnectionString);
     SqlSongGenreRepository = new SqlSongGenreRepository(ConnectionString);
     SqlSongMediaAssetRepository = new SqlSongMediaAssetRepository(ConnectionString);
     SqlUserRepository = new SqlUserRepository(ConnectionString);
     SqlUserPlaylistRepository = new SqlUserPlaylistRepository(ConnectionString);
 }
Пример #2
0
        private List<Song> GetArtistSongCollection(IEnumerable<Album> albumCollection)
        {
            var albumSongRepository = new SqlAlbumSongRepository(ConnectionString);
            var songRepository = new SqlSongRepository(ConnectionString);

            var songCollection = new List<Song>();

            foreach (var albumSongs in albumCollection.Select(album => albumSongRepository.GetAlbumSongsByAlbumId(album.AlbumId)))
            {
                songCollection.AddRange(
                    albumSongs.Select(albumSong => songRepository.SongTable.FirstOrDefault(x => x.SongId == albumSong.SongId))
                              .ToList());
            }

            return songCollection;
        }