Exemplo n.º 1
0
        public void AddGameResult(PokerMatch match, List <PokerResult> results)
        {
            using (var db = new EFContext())
            {
                db.PokerMatches.Add(match);
                db.SaveChanges();
                var matchId = match.Id;

                for (int i = 0; i < results.Count; i++)
                {
                    results[i].PokerMatchId = matchId;
                }

                db.PokerResults.AddRange(results);

                db.SaveChanges();
            };
        }
Exemplo n.º 2
0
        public void AddGameResult(string order, int buyIn, bool winnerTakes)
        {
            List <int>         results    = new JavaScriptSerializer().Deserialize <List <int> >(order);
            List <PokerResult> resultsObj = new List <PokerResult>();

            PokerMatch match = new PokerMatch
            {
                Date             = DateTime.Now,
                IsWinnerTakesAll = winnerTakes,
                BuyIn            = buyIn
            };

            for (int i = 0; i < results.Count; i++)
            {
                resultsObj.Add(new PokerResult
                {
                    Placing      = i + 1,
                    PokerUserId  = results[i],
                    PokerMatchId = 0
                });
            }

            _pokerService.AddGameResult(match, resultsObj);
        }