public ActionResult Edit(Comment comment) { if (ModelState.IsValid) { context.Entry(comment).State = EntityState.Modified; context.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PossiblePosts = context.Posts; return View(comment); }
public ActionResult Create(Comment comment) { if (ModelState.IsValid) { context.Comments.Add(comment); context.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PossiblePosts = context.Posts; return View(comment); }