public ArchivedSongVersionDetailsContract(ArchivedSongVersion archived, ArchivedSongVersion comparedVersion, ContentLanguagePreference languagePreference) { ArchivedVersion = new ArchivedSongVersionContract(archived); ComparedVersion = comparedVersion != null ? new ArchivedSongVersionContract(comparedVersion) : null; ComparedVersionId = comparedVersion != null ? comparedVersion.Id : 0; Song = new SongContract(archived.Song, languagePreference); Name = Song.Name; ComparableVersions = archived.Song.ArchivedVersionsManager.Versions .Where(v => v != archived) .Select(a => new ArchivedObjectVersionContract(a)) .ToArray(); Versions = ComparedSongsContract.Create(archived, comparedVersion); ComparedVersionId = Versions.SecondId; }
public ArchivedSongVersionDetailsContract(ArchivedSongVersion archived, ArchivedSongVersion comparedVersion, IUserPermissionContext permissionContext) { ParamIs.NotNull(() => archived); ArchivedVersion = new ArchivedSongVersionContract(archived); ComparedVersion = comparedVersion != null ? new ArchivedSongVersionContract(comparedVersion) : null; ComparedVersionId = comparedVersion != null ? comparedVersion.Id : 0; Song = new SongContract(archived.Song, permissionContext.LanguagePreference); Name = Song.Name; ComparableVersions = archived.Song.ArchivedVersionsManager .GetPreviousVersions(archived, permissionContext) .Select(a => ArchivedObjectVersionWithFieldsContract.Create(a, a.Diff.ChangedFields.Value, a.Reason)) .ToArray(); Versions = ComparedSongsContract.Create(archived, comparedVersion); ComparedVersionId = Versions.SecondId; }