public RatedSongForUserForApiContract(FavoriteSongForUser ratedSong, IUserIconFactory userIconFactory, UserOptionalFields userFields) { this.Date = ratedSong.Date; this.Rating = ratedSong.Rating; if (ratedSong.User.Options.PublicRatings) { User = new UserForApiContract(ratedSong.User, userIconFactory, userFields); } }
public RatedSongForUserForApiContract(FavoriteSongForUser ratedSong, IUserIconFactory userIconFactory, UserOptionalFields userFields, IUserPermissionContext userPermissionContext) { Date = ratedSong.Date; Rating = ratedSong.Rating; if (ratedSong.User.Options.PublicRatings || userPermissionContext.HasPermission(PermissionToken.ViewHiddenRatings)) { User = new UserForApiContract(ratedSong.User, userIconFactory, userFields); } }
public UserMessageContract(UserMessage message, IUserIconFactory iconFactory, bool includeBody = false) { ParamIs.NotNull(() => message); Body = (includeBody ? message.Message : string.Empty); Created = message.Created; CreatedFormatted = Created.ToUniversalTime().ToString("g"); HighPriority = message.HighPriority; Id = message.Id; Inbox = message.Inbox; Read = message.Read; Receiver = new UserForApiContract(message.Receiver, iconFactory, UserOptionalFields.MainPicture); Sender = (message.Sender != null ? new UserForApiContract(message.Sender, iconFactory, UserOptionalFields.MainPicture) : null); Subject = message.Subject; }
public AlbumForUserForApiContract( AlbumForUser albumForUser, ContentLanguagePreference languagePreference, IAggregatedEntryImageUrlFactory thumbPersister, AlbumOptionalFields fields, bool shouldShowCollectionStatus, bool includeUser = false) { Album = new AlbumForApiContract(albumForUser.Album, null, languagePreference, thumbPersister, fields, SongOptionalFields.None); Rating = albumForUser.Rating; if (shouldShowCollectionStatus) { MediaType = albumForUser.MediaType; PurchaseStatus = albumForUser.PurchaseStatus; } if (includeUser) { User = new UserForApiContract(albumForUser.User); } }