public AlbumForUserContract(AlbumForUser albumForUser, ContentLanguagePreference languagePreference)
        {
            ParamIs.NotNull(() => albumForUser);

            Album = new AlbumWithAdditionalNamesContract(albumForUser.Album, languagePreference);
            Id = albumForUser.Id;
            MediaType = albumForUser.MediaType;
            PurchaseStatus = albumForUser.PurchaseStatus;
            Rating = albumForUser.Rating;
            User = new UserContract(albumForUser.User);
        }
示例#2
0
		public virtual bool Equals(AlbumForUser another) {

			if (another == null)
				return false;

			if (ReferenceEquals(this, another))
				return true;

			return this.Id == another.Id;

		}
示例#3
0
文件: User.cs 项目: rijuntun/vocadb
        /// <summary>
        /// Add album to user collection.
        /// </summary>
        /// <param name="album">Album to be added. Cannot be null.</param>
        /// <param name="status">Purchase status.</param>
        /// <param name="mediaType">Media type.</param>
        /// <param name="rating">Rating.</param>
        /// <returns>Album link. Cannot be null.</returns>
        public virtual AlbumForUser AddAlbum(Album album, PurchaseStatus status, MediaType mediaType, int rating)
        {
            ParamIs.NotNull(() => album);

            var link = new AlbumForUser(this, album, status, mediaType, rating);

            AllAlbums.Add(link);
            album.UserCollections.Add(link);
            album.UpdateRatingTotals();

            return(link);
        }
示例#4
0
        public virtual bool Equals(AlbumForUser another)
        {
            if (another == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, another))
            {
                return(true);
            }

            return(this.Id == another.Id);
        }
		public AlbumForUserForApiContract(
			AlbumForUser albumForUser, 
			ContentLanguagePreference languagePreference, 
			IEntryThumbPersister thumbPersister,
			bool ssl,
			AlbumOptionalFields fields,
			bool shouldShowCollectionStatus) {

			Album = new AlbumForApiContract(albumForUser.Album, null, languagePreference, thumbPersister, ssl, fields);
			Rating = albumForUser.Rating;

			if (shouldShowCollectionStatus) {
				MediaType = albumForUser.MediaType;
				PurchaseStatus = albumForUser.PurchaseStatus;
			}

		}