private void AssertEqual(User expected, UserContract actual) { Assert.IsNotNull(actual, "Cannot be null"); Assert.AreEqual(expected.Name, actual.Name, "Name"); Assert.AreEqual(expected.Id, actual.Id, "Id"); }
public AlbumCollection(UserContract user, AlbumCollectionRouteParams routeParams) { User = user; RouteParams = routeParams; FilterByPurchaseStatus = routeParams.purchaseStatus ?? PurchaseStatus.Nothing; }
public ArtistForUserContract(OwnedArtistForUser ownedArtistForUser, ContentLanguagePreference languagePreference) { ParamIs.NotNull(() => ownedArtistForUser); Artist = new ArtistContract(ownedArtistForUser.Artist, languagePreference); Id = ownedArtistForUser.Id; User = new UserContract(ownedArtistForUser.User); }
public FavoriteSongs(UserContract user, SongVoteRating rating, SongSortRule? sort, bool? groupByRating) : this() { GroupByRating = groupByRating; Rating = rating; Sort = sort; User = user; }
public SongListContract(SongList list, IUserPermissionContext permissionContext) : base(list) { ParamIs.NotNull(() => list); Author = new UserContract(list.Author); CanEdit = EntryPermissionManager.CanEdit(permissionContext, list); Description = list.Description; FeaturedCategory = list.FeaturedCategory; }
public AlbumForUserContract(AlbumForUser albumForUser, ContentLanguagePreference languagePreference) { ParamIs.NotNull(() => albumForUser); Album = new AlbumContract(albumForUser.Album, languagePreference); Id = albumForUser.Id; MediaType = albumForUser.MediaType; PurchaseStatus = albumForUser.PurchaseStatus; Rating = albumForUser.Rating; User = new UserContract(albumForUser.User); }
public ActivityEntryContract(ArchivedObjectVersion entry, ContentLanguagePreference languagePreference) { ParamIs.NotNull(() => entry); ArtistString = GetArtistString(entry.EntryBase, languagePreference); Author = new UserContract(entry.Author); CreateDate = entry.Created; EditEvent = entry.EditEvent; EntryRef = new EntryRefWithNameContract(entry.EntryBase, languagePreference); SongThumbUrl = GetSongThumbUrl(entry.EntryBase); }
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); }
public NewsEntryContract(NewsEntry newsEntry) { ParamIs.NotNull(() => newsEntry); Anonymous = newsEntry.Anonymous; Author = new UserContract(newsEntry.Author); CreateDate = newsEntry.CreateDate; Id = newsEntry.Id; Important = newsEntry.Important; Stickied = newsEntry.Stickied; Text = newsEntry.Text; }
public ActivityEntryContract(ActivityEntry entry, ContentLanguagePreference languagePreference) { ParamIs.NotNull(() => entry); ArtistString = GetArtistString(entry.EntryBase, languagePreference); Author = new UserContract(entry.Author); CreateDate = entry.CreateDate; EditEvent = entry.EditEvent; EntryRef = new EntryWithImageContract(entry.EntryBase, GetMime(entry.EntryBase), languagePreference); SongThumbUrl = GetSongThumbUrl(entry.EntryBase); }
public UserMessageContract(UserMessage message) { ParamIs.NotNull(() => message); Body = message.Message; Created = message.Created; HighPriority = message.HighPriority; Id = message.Id; Read = message.Read; Receiver = new UserContract(message.Receiver); Sender = new UserContract(message.Sender); Subject = message.Subject; }
private bool HandleCreate(UserContract user) { if (user == null) { ModelState.AddModelError("UserName", ViewRes.User.CreateStrings.UsernameTaken); return false; } else { FormsAuthentication.SetAuthCookie(user.Name, false); return true; } }
public static void SetLoggedUser(UserContract user) { ParamIs.NotNull(() => user); if (!HttpContext.Current.User.Identity.IsAuthenticated) throw new InvalidOperationException("Must be authenticated"); HttpContext.Current.User = new VocaDbPrincipal(HttpContext.Current.User.Identity, user); }
public VocaDbPrincipal(IIdentity identity, UserContract user) : base(identity, new string[] {}) { this.user = user; }