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); }
private List<Playlist> GetBusinessPlaylists(int userId) { var businessPlaylistRepository = new SqlUserPlaylistRepository(ConnectionString); var playlistRepository = new SqlPlaylistRepository(ConnectionString); var businessPlaylists = businessPlaylistRepository.GetUserPlaylistsByUserId(userId); var playlists = businessPlaylists.Select( businessPlaylist => playlistRepository.Playlist.FirstOrDefault(x => x.PlaylistId == businessPlaylist.PlaylistId)) .ToList(); return playlists; }