public ActionResult Create(Comment comment) { if (ModelState.IsValid) { db.Comments.Add(comment); db.SaveChanges(); return RedirectToAction("Post", "Blog", new { id = comment.PostID }); } return View(comment); }
public ActionResult Edit(Comment comment) { if (ModelState.IsValid) { db.Entry(comment).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(comment); }
// // GET: /Comment/Create public ActionResult Create(int postID) { Comment comment = new Comment(); comment.PostID = postID; return View(comment); }