public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var post = db.Post.Find(id); if (post == null) { return(HttpNotFound()); } var viewModel = new DeleteBlogViewModel { BlogId = post.Id }; return(View(viewModel)); }