Example #1
0
 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");
 }
Example #2
0
 public IActionResult Index(Topic topic)
 {
     if (ModelState.IsValid)
     {
         topic.CreateOn = DateTime.Now;
         _context.Topics.Add(topic);
         _context.SaveChanges();
     }
     return RedirectToAction("Index");
 }