Exemplo n.º 1
0
 public BattlePet Update(BattlePet battlePet)
 {
     using (var trans = _ctx.Database.BeginTransaction())
     {
         try
         {
             _ctx.Entry(battlePet).State = EntityState.Modified;
             _ctx.SaveChanges();
             trans.Commit();
             return(GetBattlePet(battlePet.BlizzardId));
         }
         catch
         {
             trans.Rollback();
             throw;
         }
     }
 }
Exemplo n.º 2
0
 public BattlePet Create(BattlePet battlePet)
 {
     using (var trans = _ctx.Database.BeginTransaction())
     {
         try
         {
             _ctx.BattlePets.Add(battlePet);
             _ctx.SaveChanges();
             trans.Commit();
             return(GetBattlePet(battlePet.BlizzardId));
         }
         catch
         {
             trans.Rollback();
             throw;
         }
     }
 }