public override int Delete(Users user)
        {
            NoteRepository    nr = new NoteRepository();
            LikedRepository   lr = new LikedRepository();
            CommentRepository cr = new CommentRepository();

            foreach (var note in user.Notes.ToList())
            {
                foreach (Liked like in note.Likes.ToList())
                {
                    lr.Delete(like);
                }

                foreach (Comment comment in note.Comments.ToList())
                {
                    cr.Delete(comment);
                }

                nr.Delete(note);
            }
            List <Liked>   Likedd  = lr.List(x => x.LikedUser.Id == user.Id);
            List <Comment> Comment = cr.List(x => x.Owner.Id == user.Id);

            foreach (var item in Likedd)
            {
                lr.Delete(item);
            }
            foreach (var item in Comment)
            {
                cr.Delete(item);
            }
            return(base.Delete(user));
        }
Beispiel #2
0
        public override int Delete(Note note)
        {
            NoteRepository    nr = new NoteRepository();
            LikedRepository   lr = new LikedRepository();
            CommentRepository cr = new CommentRepository();
            UserRepository    ur = new UserRepository();

            List <Liked>   Likedd  = lr.List(x => x.Note.Id == note.Id);
            List <Comment> Comment = cr.List(x => x.Note.Id == note.Id);

            foreach (var item in Likedd)
            {
                lr.Delete(item);
            }
            foreach (var item in Comment)
            {
                cr.Delete(item);
            }

            return(base.Delete(note));
        }
Beispiel #3
0
        public override int Delete(Category category)
        {
            NoteRepository    nr = new NoteRepository();
            LikedRepository   lr = new LikedRepository();
            CommentRepository cr = new CommentRepository();

            foreach (Note note in category.Notes.ToList())
            {
                foreach (Liked like in note.Likes.ToList())
                {
                    lr.Delete(like);
                }

                foreach (Comment comment in note.Comments.ToList())
                {
                    cr.Delete(comment);
                }

                nr.Delete(note);
            }

            return(base.Delete(category));
        }