Пример #1
0
 protected void DeleteButton_Click(object sender, EventArgs e)
 {
     try
     {
         BlogManager.DeleteBlogPost(this.BlogPostId);
         Response.Redirect("Blog.aspx");
     }
     catch (Exception exc)
     {
         ProcessException(exc);
     }
 }
Пример #2
0
        public IActionResult DeleteBlogPost(string id)
        {
            var blogPost = _blogManager.GetBlogPost(id);

            if (!_blogSecurity.AuthorizeForDelete(blogPost))
            {
                return(Unauthorized());
            }

            try
            {
                _blogManager.DeleteBlogPost(blogPost);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }