Пример #1
0
        public void BlAddCard(Message m)
        {
            PlayerCardDb db = new PlayerCardDb();

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

            db.Insert(c);
        }
Пример #2
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);
        }