コード例 #1
0
        public ActionResult Create(StageModel stagemodel)
        {
            if (ModelState.IsValid)
            {
                db.StageModels.Add(stagemodel);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.GameId = new SelectList(db.GameModels, "GameId", "Name", stagemodel.GameId);
            return View(stagemodel);
        }
コード例 #2
0
 public ActionResult Edit(StageModel stagemodel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stagemodel).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.GameId = new SelectList(db.GameModels, "GameId", "Name", stagemodel.GameId);
     return View(stagemodel);
 }