/// <summary> /// Cleans up all links to other entries so that this entry can be deleted. /// </summary> public virtual void DeleteLinks() { var artistLinks = AllArtists.ToArray(); foreach (var artist in artistLinks) { artist.Delete(); } var songLinks = AllSongs.ToArray(); foreach (var song in songLinks) { song.Delete(); } var users = UserCollections.ToArray(); foreach (var user in users) { user.Delete(); } Tags.DeleteUsages(); // Archived versions and comments are cascaded }
/// <summary> /// Cleans up all links to other entries so that this entry can be deleted. /// </summary> public virtual void DeleteLinks() { var artistLinks = AllArtists.ToArray(); foreach (var artist in artistLinks) { artist.Delete(); } var songLinks = AllSongs.ToArray(); foreach (var song in songLinks) { song.Delete(); } var users = UserCollections.ToArray(); foreach (var user in users) { user.Delete(); } //ArchivedVersionsManager.Clear(); //Comments.Clear(); }
public async Task <ActionResult <UserCollections> > PostUserCollections(UserCollections userCollections) { _context.UserCollections.Add(userCollections); await _context.SaveChangesAsync(); return(CreatedAtAction("GetUserCollections", new { id = userCollections.Id }, userCollections)); }
public async Task <IActionResult> PutUserCollections(int id, UserCollections userCollections) { if (id != userCollections.Id) { return(BadRequest()); } _context.Entry(userCollections).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserCollectionsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// При выборе выгрузки /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void UploadUserCollectionViewCell_Tapped(object sender, EventArgs e) { var usercollections = new List <UserCollections>(); foreach (var usercollection in Collections) { usercollections.Add(UserCollections.Convert(usercollection)); } GetUserCollectionsContentPage = new GetUserCollectionsContentPage(new ObservableCollection <UserCollections>(usercollections), SelectedCollection); GetUserCollectionsContentPage.ItemSelectedEvent += GetUserCollectionsContentPage_Item_Selected_Event; Navigation.PushAsync(GetUserCollectionsContentPage); }
public void CloneCollection() { var user = new UserCollections(); user.Add(new User() { Name = "Alen" }); user.TestValue = "Alen"; user.us = new User() { Name = "Toma" }; var cloned = DeepCloner.Clone(user); }
public void CloneCollection() { var user = new UserCollections(); user.Add(new User() { Name = "Alen" }); user.TestValue = "Alen"; user.us = new User() { Name = "Toma" }; var cloned = DeepCloner.Clone(user); Assert.AreEqual(cloned.us.Name, user.us.Name); Assert.AreEqual(cloned.TestValue, "Alen"); }
public virtual void UpdateRatingTotals() { RatingCount = UserCollections.Where(a => a.Rating != AlbumForUser.NotRated).Count(); RatingTotal = UserCollections.Sum(a => a.Rating); RatingAverageInt = RatingCount > 0 ? (RatingTotal * 100 / RatingCount) : 0; }
public virtual bool IsInUserCollection(User user) { ParamIs.NotNull(() => user); return(UserCollections.Any(w => w.User.Equals(user))); }