public void Edit(Battle battle)
 {
     if (ModelState.IsValid)
     {
         db.Entry(battle).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
示例#2
0
 public void Update(Hero aHero)
 {
     using (var context = new BattleContext())
     {
         DbEntityEntry <Hero> heroToUpdate = context.Entry(aHero);
         heroToUpdate.CurrentValues.SetValues(aHero);
         context.SaveChanges();
     }
 }
示例#3
0
 public void Update(Weapon aWeapon)
 {
     using (var context = new BattleContext())
     {
         DbEntityEntry <Weapon> WeaponToUpdate = context.Entry(aWeapon);
         WeaponToUpdate.CurrentValues.SetValues(aWeapon);
         context.SaveChanges();
     }
 }
示例#4
0
 public void Update(Villain aVillain)
 {
     using (var context = new BattleContext())
     {
         DbEntityEntry <Villain> villainToUpdate = context.Entry(aVillain);
         villainToUpdate.CurrentValues.SetValues(aVillain);
         context.SaveChanges();
     }
 }
 public void EditBattle(Battle battle)
 {
     db.Entry(battle).State = EntityState.Modified;
     db.SaveChanges();
 }