Exemplo n.º 1
0
		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");

		}
Exemplo n.º 2
0
        public AlbumCollection(UserContract user, AlbumCollectionRouteParams routeParams)
        {
            User = user;
            RouteParams = routeParams;

            FilterByPurchaseStatus = routeParams.purchaseStatus ?? PurchaseStatus.Nothing;
        }
Exemplo n.º 3
0
        public ArtistForUserContract(OwnedArtistForUser ownedArtistForUser, ContentLanguagePreference languagePreference)
        {
            ParamIs.NotNull(() => ownedArtistForUser);

            Artist = new ArtistContract(ownedArtistForUser.Artist, languagePreference);
            Id     = ownedArtistForUser.Id;
            User   = new UserContract(ownedArtistForUser.User);
        }
Exemplo n.º 4
0
        public ArtistForUserContract(OwnedArtistForUser ownedArtistForUser, ContentLanguagePreference languagePreference)
        {
            ParamIs.NotNull(() => ownedArtistForUser);

            Artist = new ArtistContract(ownedArtistForUser.Artist, languagePreference);
            Id = ownedArtistForUser.Id;
            User = new UserContract(ownedArtistForUser.User);
        }
Exemplo n.º 5
0
 public FavoriteSongs(UserContract user, SongVoteRating rating, SongSortRule? sort, bool? groupByRating)
     : this()
 {
     GroupByRating = groupByRating;
     Rating = rating;
     Sort = sort;
     User = user;
 }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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;
        }
Exemplo n.º 11
0
		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);

		}
Exemplo n.º 12
0
        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;
        }
Exemplo n.º 13
0
        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;
        }
Exemplo n.º 14
0
 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;
     }
 }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
 public VocaDbPrincipal(IIdentity identity, UserContract user)
     : base(identity, new string[] {})
 {
     this.user = user;
 }