Esempio n. 1
0
        public ActionResult Battle(Battle battle)
        {
            db.Battle.Add(battle);
            db.SaveChanges();

            return(View("Chempionsip"));
        }
Esempio n. 2
0
 public void Create(Hero aHero)
 {
     using (var context = new BattleContext())
     {
         context.Heroes.Add(aHero);
         context.SaveChanges();
     }
 }
Esempio n. 3
0
 public void Create(Weapon aWeapon)
 {
     using (var context = new BattleContext())
     {
         context.Weapons.Add(aWeapon);
         context.SaveChanges();
     }
 }
Esempio n. 4
0
 public void Create(Villain aVillain)
 {
     using (var context = new BattleContext())
     {
         context.Villains.Add(aVillain);
         context.SaveChanges();
     }
 }
Esempio n. 5
0
 public void Update(Hero aHero)
 {
     using (var context = new BattleContext())
     {
         DbEntityEntry <Hero> heroToUpdate = context.Entry(aHero);
         heroToUpdate.CurrentValues.SetValues(aHero);
         context.SaveChanges();
     }
 }
Esempio n. 6
0
 public void Update(Weapon aWeapon)
 {
     using (var context = new BattleContext())
     {
         DbEntityEntry <Weapon> WeaponToUpdate = context.Entry(aWeapon);
         WeaponToUpdate.CurrentValues.SetValues(aWeapon);
         context.SaveChanges();
     }
 }
Esempio n. 7
0
 public void Update(Villain aVillain)
 {
     using (var context = new BattleContext())
     {
         DbEntityEntry <Villain> villainToUpdate = context.Entry(aVillain);
         villainToUpdate.CurrentValues.SetValues(aVillain);
         context.SaveChanges();
     }
 }
Esempio n. 8
0
 public void Delete(int anId)
 {
     using (var context = new BattleContext())
     {
         Hero heroToDelete = context.Heroes.Find(anId);
         if (heroToDelete != null)
         {
             context.Heroes.Remove(heroToDelete);
             context.SaveChanges();
         }
     }
 }
Esempio n. 9
0
 public void Delete(int anId)
 {
     using (var context = new BattleContext())
     {
         Weapon weaponToDelete = context.Weapons.Find(anId);
         if (weaponToDelete != null)
         {
             context.Weapons.Remove(weaponToDelete);
             context.SaveChanges();
         }
     }
 }
Esempio n. 10
0
 public void Delete(int anId)
 {
     using (var context = new BattleContext())
     {
         Villain villainToDelete = context.Villains.Find(anId);
         if (villainToDelete != null)
         {
             context.Villains.Remove(villainToDelete);
             context.SaveChanges();
         }
     }
 }
 public void EditBattle(Battle battle)
 {
     db.Entry(battle).State = EntityState.Modified;
     db.SaveChanges();
 }