public ActionResult Comment(BlogComment blogcomment) { if (ModelState.IsValid) { db.Comments.Add(blogcomment.Comment); db.SaveChanges(); return RedirectToAction("Comment"); } return View(blogcomment); }
// GET: Blogs/Edit/5 public ActionResult Comment(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Blog blog = db.Blogs.Find(id); if (blog == null) { return HttpNotFound(); } BlogComment bc = new BlogComment(); bc.Blog = blog; bc.Comment = new Comment(); return View(bc); }