예제 #1
0
파일: Bl.cs 프로젝트: samuelarbibe/taki
        public void BlAddCard(Message m)
        {
            PlayerCardDb db = new PlayerCardDb();

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

            db.Insert(c);
        }
예제 #2
0
파일: Bl.cs 프로젝트: samuelarbibe/taki
        // 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);
        }