public void BlSwitchHands(Message m) { PlayerCardDb db = new PlayerCardDb(); PlayerDb playerDb = new PlayerDb(); db.SwitchConnectionsByPlayersId(m.Target, playerDb.GetPlayerById(m.Card.Id)); }
public void BlRemoveCard(Message m) { PlayerCardDb db = new PlayerCardDb(); PlayerCardConnection temp = db.GetConnectionByPlayerIdAndCardId(m.Target, m.Card); db.Delete(temp); }
public void BlAddCard(Message m) { PlayerCardDb db = new PlayerCardDb(); PlayerCardConnection c = new PlayerCardConnection() { Player = m.Target, Card = m.Card }; db.Insert(c); }
// insert game into database, including connections in PlayerGameDB and PlayerCardDB public Game BlStartGameDatabase(Game g) { PlayerDb playerDb = new PlayerDb(); GameDb gameDb = new GameDb(); PlayerGameDb playerGameDb = new PlayerGameDb(); PlayerCardDb playerCardDb = new PlayerCardDb(); playerDb.InsertList(g.Players); gameDb.Insert(g); // assign ID to game, and all players' IDs in there playerGameDb.Insert(g); playerCardDb.Insert(g); // save the changes and insert the data into the database gameDb.SaveChanges(); return(g); }
public int SaveChanges() { PlayerCardDb sb = new PlayerCardDb(); return(sb.SaveChanges()); }