示例#1
0
        public FrontPageContract(IEnumerable<ActivityEntry> activityEntries, IEnumerable<NewsEntry> newsEntries,
            AlbumContract[] newAlbums, IEnumerable<UnifiedCommentContract> recentComments, IEnumerable<Album> topAlbums, Song[] newSongs,
            SongVoteRating firstSongRating,
            ContentLanguagePreference languagePreference)
        {
            ActivityEntries = activityEntries.Select(e => new ActivityEntryContract(e, languagePreference)).ToArray();
            NewAlbums = newAlbums;
            NewSongs = newSongs.Select(s => new SongWithPVAndVoteContract(s, SongVoteRating.Nothing, languagePreference)).ToArray();
            NewsEntries = newsEntries.Select(e => new NewsEntryContract(e)).ToArray();
            RecentComments = recentComments.ToArray();
            TopAlbums = topAlbums.Select(a => new AlbumWithAdditionalNamesContract(a, languagePreference)).ToArray();

            FirstSong = (newSongs.Any() ? new SongWithPVAndVoteContract(newSongs.First(), firstSongRating, languagePreference) : null);
        }