コード例 #1
0
ファイル: LobbyViewModel.cs プロジェクト: zilveer/BitPoker
        public void AddNewTable(UInt64 smallBlind, UInt64 bigBlind, UInt64 minBuyIn, UInt64 maxBuyIn, Int16 minPlayers, Int16 maxPlayers)
        {
            BitPoker.Models.Contracts.Table table = new BitPoker.Models.Contracts.Table()
            {
                SmallBlind     = smallBlind,
                BigBlind       = bigBlind,
                MinBuyIn       = minBuyIn,
                MaxBuyIn       = maxBuyIn,
                MinPlayers     = minPlayers,
                MaxPlayers     = maxPlayers,
                NetworkAddress = "p2p"
            };

            if (!table.IsValid())
            {
                throw new AggregateException("Invalid table params");
            }

            //Check for duplicates
            using (BitPoker.Repository.ITableRepository tableRepo = new BitPoker.Repository.LiteDB.TableRepository(@"poker.db"))
            {
                tableRepo.Add(table);
                tableRepo.Save();
            }
        }