Пример #1
0
        public ActionResult Create(Game gm)
        {
            if (ModelState.IsValid)
            {
                gm.IntroduceDate = DateTime.Now;
                db.Games.Add(gm);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(gm);
        }
Пример #2
0
 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);
 }