public ArchivedArtistVersionDetailsContract(ArchivedArtistVersion archived, ArchivedArtistVersion comparedVersion, ContentLanguagePreference languagePreference) { ArchivedVersion = new ArchivedArtistVersionContract(archived); Artist = new ArtistContract(archived.Artist, languagePreference); ComparedVersion = comparedVersion != null ? new ArchivedArtistVersionContract(comparedVersion) : null; ComparedVersionId = comparedVersion != null ? comparedVersion.Id : 0; Name = Artist.Name; ComparableVersions = archived.Artist.ArchivedVersionsManager.Versions .Where(v => v != archived) .Select(a => new ArchivedObjectVersionContract(a)) .ToArray(); Versions = ComparedArtistsContract.Create(archived, comparedVersion); ComparedVersionId = Versions.SecondId; }
public ArchivedArtistVersionDetailsContract(ArchivedArtistVersion archived, ArchivedArtistVersion comparedVersion, IUserPermissionContext permissionContext) { ParamIs.NotNull(() => archived); ArchivedVersion = new ArchivedArtistVersionContract(archived); Artist = new ArtistContract(archived.Artist, permissionContext.LanguagePreference); ComparedVersion = comparedVersion != null ? new ArchivedArtistVersionContract(comparedVersion) : null; ComparedVersionId = comparedVersion != null ? comparedVersion.Id : 0; Name = Artist.Name; ComparableVersions = archived.Artist.ArchivedVersionsManager .GetPreviousVersions(archived, permissionContext) .Select(a => ArchivedObjectVersionWithFieldsContract.Create(a, a.Diff.ChangedFields.Value, a.Reason)) .ToArray(); Versions = ComparedArtistsContract.Create(archived, comparedVersion); ComparedVersionId = Versions.SecondId; }