public void Edit(Battle battle) { if (ModelState.IsValid) { db.Entry(battle).State = EntityState.Modified; db.SaveChanges(); } }
public void Update(Hero aHero) { using (var context = new BattleContext()) { DbEntityEntry <Hero> heroToUpdate = context.Entry(aHero); heroToUpdate.CurrentValues.SetValues(aHero); context.SaveChanges(); } }
public void Update(Weapon aWeapon) { using (var context = new BattleContext()) { DbEntityEntry <Weapon> WeaponToUpdate = context.Entry(aWeapon); WeaponToUpdate.CurrentValues.SetValues(aWeapon); context.SaveChanges(); } }
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(); }