public IActionResult EditSave(Topic topic) { _context.Attach(topic); _context.Entry(topic).Property(r => r.Title).IsModified = true; _context.Entry(topic).Property(r => r.Content).IsModified = true; _context.SaveChanges(); return RedirectToAction("Index"); }
public IActionResult Index(Topic topic) { if (ModelState.IsValid) { topic.CreateOn = DateTime.Now; _context.Topics.Add(topic); _context.SaveChanges(); } return RedirectToAction("Index"); }