Esempio n. 1
0
        public IActionResult OnPost(int postId)
        {
            var post = postData.DeletePost(postId);

            postData.Commit();
            if (post == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            return(RedirectToPage("./List"));
        }
        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);
        }
 public IActionResult Delete(int PostId, int id)
 {
     pd.DeletePost(PostId);
     pd.Commit();
     return(RedirectToAction("MyPost", "Post", new { id }));
 }
Esempio n. 4
0
 public IActionResult OnGet(int Id, int PostId)
 {
     postdata.DeletePost(PostId);
     postdata.commit();
     return(RedirectToPage("./Home", new { Id }));
 }