Пример #1
0
        public AlbumForApiContract(TranslatedAlbumContract album, ContentLanguagePreference languagePreference, IEntryThumbPersister thumbPersister, AlbumOptionalFields fields)
        {
            ParamIs.NotNull(() => album);

            ArtistString  = album.TranslatedArtistString.GetBestMatch(languagePreference);
            CreateDate    = album.CreateDate;
            Deleted       = album.Deleted;
            DiscType      = album.DiscType;
            Id            = album.Id;
            Name          = album.Names.SortNames[languagePreference];
            RatingAverage = album.RatingAverage;
            RatingCount   = album.RatingCount;
            ReleaseDate   = album.ReleaseDate;
            Status        = album.Status;
            Version       = album.Version;

            if (fields.HasFlag(AlbumOptionalFields.AdditionalNames))
            {
                AdditionalNames = album.Names.GetAdditionalNamesStringForLanguage(languagePreference);
            }

            if (fields.HasFlag(AlbumOptionalFields.MainPicture))
            {
                MainPicture = new EntryThumbForApiContract(new EntryThumb(album, album.CoverPictureMime), thumbPersister);
            }

            if (fields.HasFlag(AlbumOptionalFields.ReleaseEvent))
            {
                ReleaseEvent = album.ReleaseEvent;
            }
        }
Пример #2
0
        public AlbumContract(TranslatedAlbumContract album, ContentLanguagePreference languagePreference)
        {
            ParamIs.NotNull(() => album);

            AdditionalNames = album.Names.GetAdditionalNamesStringForLanguage(languagePreference);
            ArtistString    = album.TranslatedArtistString.GetBestMatch(languagePreference);
            CreateDate      = album.CreateDate;
            DiscType        = album.DiscType;
            Id            = album.Id;
            Name          = album.Names.SortNames[languagePreference];
            RatingAverage = album.RatingAverage;
            RatingCount   = album.RatingCount;
            ReleaseDate   = album.ReleaseDate;
            ReleaseEvent  = album.ReleaseEvent;
            Status        = album.Status;
            Version       = album.Version;
        }