public ActionResult Create(Comment comment) { comment.PostDate = DateTime.Now; if (ModelState.IsValid) { db.Comments.Add(comment); db.SaveChanges(); return Redirect(PrevURL.AbsolutePath); } 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); }