private DateTime?GoToPageAndScrapData(string url, SingleBet matchPartBet, SingleBetResult matchPartResult, IWebDriver driver, MatchPart matchPart)
        {
            var htmlDoc = new HtmlDocument();

            if (string.IsNullOrEmpty(driver.Url) || driver.Url == "data:,")
            {
                driver.Url = url;
            }
            else
            {
                driver.Navigate().GoToUrl(url);
                driver.Navigate().Refresh();
            }

            htmlDoc.LoadHtml(driver.PageSource);

            var detailsCol = htmlDoc.DocumentNode.Descendants().First(n => n.Id == "col-left").ChildNodes.First(n => n.Id == "col-content");

            var matchPartsOddsList = detailsCol.Descendants("ul").First(n => n.HasClass("sub-menu") && n.HasClass("subactive"));

            if ((int)matchPart < matchPartsOddsList.ChildNodes.Count)
            {
                GetOddsAndFillData(detailsCol, matchPartBet, matchPartResult);

                return(GetMatchDate(detailsCol.ChildNodes.FindFirst("p")));
            }

            return(null);
        }
        public SoccerStatsModel(SingleBetResult result, bool hosts, IEnumerable <SoccerTeamStatsRowModel> stats)
        {
            var ballPossession = stats.FirstOrDefault(s => s.StatsName == "Posiadanie piłki");
            var attacksOnGoal  = stats.FirstOrDefault(s => s.StatsName == "Sytuacje bramkowe");
            var shotsOnGoal    = stats.FirstOrDefault(s => s.StatsName == "Strzały na bramkę");
            var shotsOutGoal   = stats.FirstOrDefault(s => s.StatsName == "Strzały niecelne");
            var corners        = stats.FirstOrDefault(s => s.StatsName == "Rzuty rożne");
            var passes         = stats.FirstOrDefault(s => s.StatsName == "Podania");
            var accuratePasses = stats.FirstOrDefault(s => s.StatsName == "Podania celne");
            var blocks         = stats.FirstOrDefault(s => s.StatsName == "Bloki");

            BallPossession = ballPossession?.StatsValue ?? 0;
            AttacksOnGoal  = attacksOnGoal?.StatsValue ?? 0;
            ShotsOnGoal    = shotsOnGoal?.StatsValue ?? 0;
            ShotsOutGoal   = shotsOutGoal?.StatsValue ?? 0;
            Corners        = corners?.StatsValue ?? 0;
            Passes         = passes?.StatsValue ?? 0;
            AccuratePasses = accuratePasses?.StatsValue ?? 0;
            Blocks         = blocks?.StatsValue ?? 0;
            if (result == SingleBetResult.Draw)
            {
                ResultPoints = 1;
            }
            else
            {
                ResultPoints = hosts ? result == SingleBetResult.Hosts ? 3 : 0
                    :
                               result == SingleBetResult.Guests ? 3 : 0;
            }
        }
        private void GetOddsAndFillData(HtmlNode detailsCol, SingleBet matchPart, SingleBetResult matchPartResult)
        {
            matchPart.Result = matchPartResult;
            var odds = GetOddsList(detailsCol).ToList();

            matchPart.Odds = odds.Select(o => new SingleBetOdds
            {
                Hosts  = o.Hosts,
                Draw   = o.Draw,
                Guests = o.Guests
            });
        }