コード例 #1
0
ファイル: LeaguesByDB.cs プロジェクト: olegJohnFrid/poker
        public void RemoveRoomFromLeague(League league, Room room)
        {
            LeagueDB l = CreateLeagueDB(league);

            if (l == null)
            {
                return;
            }
            l.Rooms.Remove(RoomsByDB.CreateRoomDB(room));
            league.Rooms.Remove(room);
            db.SaveChanges();
            Log.InfoLog("DB:Remove Room " + room.Id + " From League " + league.Id);
        }
コード例 #2
0
ファイル: LeaguesByDB.cs プロジェクト: olegJohnFrid/poker
        public void AddRoomToLeague(League league, Room room)
        {
            LeagueDB ldb = CreateLeagueDB(league);

            if (ldb.Rooms.Count != 0 && ldb.Rooms.Any(l => l.id == room.Id))
            {
                return;
            }
            RoomDB rdb = RoomsByDB.CreateRoomDB(room);

            ldb.Rooms.Add(rdb);
            league.Rooms.Add(room);
            db.SaveChanges();
            Log.InfoLog("DB:Add Room " + room.Id + " to a League " + league.Id);
        }
コード例 #3
0
ファイル: LeaguesByDB.cs プロジェクト: olegJohnFrid/poker
        public static LeagueDB CreateLeagueDB(League league)
        {
            LeagueDB l;

            if (db.LeagueDBs.Count() != 0)
            {
                try
                {
                    return(db.LeagueDBs.First(lea => lea.id == league.Id));
                }
                catch { }
            }
            l = new LeagueDB
            {
                id   = league.Id,
                name = league.Name
            };
            foreach (Room r in league.Rooms)
            {
                l.Rooms.Add(RoomsByDB.CreateRoomDB(r));
            }
            return(l);
        }