public ActionResult DeleteConfirmed(int id)
        {
            Song song = songManager.Find(x => x.Id == id);

            songManager.Delete(song);
            return(RedirectToAction("Index"));
        }
        public override int Delete(Category category)
        {
            SongManager    noteManager    = new SongManager();
            LikedManager   likedManager   = new LikedManager();
            CommentManager commentManager = new CommentManager();

            // Kategori ile ilişkili notların silinmesi gerekiyor.
            foreach (Song note in category.Songs.ToList())
            {
                // Song ile ilişikili like'ların silinmesi.
                foreach (Liked like in note.Likes.ToList())
                {
                    likedManager.Delete(like);
                }

                // Song ile ilişkili comment'lerin silinmesi
                foreach (Comment comment in note.Comments.ToList())
                {
                    commentManager.Delete(comment);
                }

                noteManager.Delete(note);
            }

            return(base.Delete(category));
        }
Beispiel #3
0
 public Song Delete(int id)
 {
     return(_songManager.Delete(id));
 }