Example #1
0
        public void BlSwitchHands(Message m)
        {
            PlayerCardDb db       = new PlayerCardDb();
            PlayerDb     playerDb = new PlayerDb();

            db.SwitchConnectionsByPlayersId(m.Target, playerDb.GetPlayerById(m.Card.Id));
        }
Example #2
0
        public void BlRemoveCard(Message m)
        {
            PlayerCardDb db = new PlayerCardDb();

            PlayerCardConnection temp = db.GetConnectionByPlayerIdAndCardId(m.Target, m.Card);

            db.Delete(temp);
        }
Example #3
0
        public void BlAddCard(Message m)
        {
            PlayerCardDb db = new PlayerCardDb();

            PlayerCardConnection c = new PlayerCardConnection()
            {
                Player = m.Target,
                Card   = m.Card
            };

            db.Insert(c);
        }
Example #4
0
        // 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);
        }
Example #5
0
        public int SaveChanges()
        {
            PlayerCardDb sb = new PlayerCardDb();

            return(sb.SaveChanges());
        }