public ActionResult Edit([Bind(Include = "Id,Name,ChallengeRating,UrlId")] MonsterDataModel monsterDataModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(monsterDataModel).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(monsterDataModel);
 }
예제 #2
0
        public ActionResult Edit([Bind(Include = "Id")] Encounter encounter)
        {
            if (ModelState.IsValid)
            {
                db.Entry(encounter).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(encounter));
        }
 public ActionResult Edit([Bind(Include = "Id,EncounterId,MonsterId,HealthPoints,IsAlive")] ActiveMonster activeMonster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(activeMonster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Details", "Encounters", new { id = activeMonster.EncounterId }));
     }
     ViewBag.EncounterId = new SelectList(db.Encounters, "Id", "Id", activeMonster.EncounterId);
     ViewBag.MonsterId   = new SelectList(db.Monsters, "Id", "Name", activeMonster.MonsterId);
     return(View(activeMonster));
 }