Пример #1
0
        public ActionResult <Post> DeletePost(int id)
        {
            var post = _postData.GetPostById(id);

            if (post == null)
            {
                return(NotFound());
            }

            _postData.DeletePost(id);
            _postData.DeleteComment(id);
            _postData.Commit();

            return(post);
        }
Пример #2
0
 public IActionResult Delete(int CommentId, int PostId)
 {
     pd.DeleteComment(CommentId);
     pd.Commit();
     return(RedirectToAction("Details", "Home", new { PostId }));
 }
Пример #3
0
 public IActionResult OnPostDeleteComment(int commentId)
 {
     _postData.DeleteComment(commentId);
     return(RedirectToPage());
 }