public IActionResult Create(Comment comment) { if (comment.ID != 0) comment.ID = 0; if (ModelState.IsValid) { _context.Comment.Add(comment); _context.SaveChanges(); return RedirectToAction("Index"); } return View(comment); }
public IActionResult Edit(Comment comment) { if (ModelState.IsValid) { _context.Update(comment); _context.SaveChanges(); return RedirectToAction("Index"); } return View(comment); }