public ActionResult DeleteABlog(BlogVM blogVM) { BlogManager manager = BlogManagerFactory.Create(); manager.DeleteBlog(blogVM.Blog.BlogPostId); return(RedirectToAction("MyBlogs")); }
public IActionResult DeleteBlog([FromRoute] int id) { if (ModelState.IsValid) { BlogManager blogManager = new BlogManager(this._unitOfWork); if (blogManager.DeleteBlog(id) != 0) { return(StatusCode(204)); } else { return(StatusCode(501)); } } //if (!ModelState.IsValid) //{ // return BadRequest(ModelState); //} //var blog = await this._unitOfWork.GetRepository<Blog>().Single(m => m.BlogId == id); ////var blog = await _context.Blog.SingleOrDefaultAsync(m => m.BlogId == id); //if (blog == null) //{ // return NotFound(); //} return(Ok()); }
private void button_DeleteBlog_Click(object sender, RoutedEventArgs e) { bm.DeleteBlog(textBox_blogUrl.Text); }