public ActionResult Create(Game gm) { if (ModelState.IsValid) { gm.IntroduceDate = DateTime.Now; db.Games.Add(gm); db.SaveChanges(); return RedirectToAction("Index"); } return View(gm); }
public ActionResult Edit(Game gm) { if (ModelState.IsValid) { db.Entry(gm).State = EntityState.Modified; gm.IntroduceDate = DateTime.Now; db.SaveChanges(); return RedirectToAction("Index"); } return View(gm); }