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());
 }