public void AddEventsList(List <OddEvent> oddEvents)
        {
            foreach (OddEvent oddEvent in oddEvents)
            {
                PinData pinData = this.ConvertOddEventToPinData(oddEvent);

                this.Add(pinData);
            }
        }
        private PinData ConvertOddEventToPinData(OddEvent oddEvent)
        {
            OddPeriod oddPeriod = oddEvent.Periods[0];
            PinData   data      = new PinData();

            data.DateAdded = DateTime.Now.AddHours(2);

            data.HomeScore = oddEvent.HomeScore;
            data.AwayScore = oddEvent.AwayScore;

            data.Totals    = new List <PinTotal>();
            data.HandiCaps = new List <PinHdp>();

            data.EventId   = oddEvent.EventId;
            data.StartTime = oddEvent.StartTime;
            data.HomeTeam  = oddEvent.HomeTeam;
            data.AwayTeam  = oddEvent.AwayTeam;
            if (oddPeriod.MoneyLine != null)
            {
                data.Home = oddPeriod.MoneyLine.Home.ToString();
                data.Away = oddPeriod.MoneyLine.Away.ToString();
                data.Draw = oddPeriod.MoneyLine.Draw.ToString();
            }

            if (oddPeriod.Totals != null && oddPeriod.Totals.Count > 0)
            {
                foreach (Total total in oddPeriod.Totals)
                {
                    data.Totals.Add(new PinTotal()
                    {
                        Points = total.Points.ToString(), Over = total.Over.ToString(), Under = total.Under.ToString()
                    });
                }
            }

            if (oddPeriod.Spreads != null && oddPeriod.Spreads.Count > 0)
            {
                foreach (OddsSpread spread in oddPeriod.Spreads)
                {
                    data.HandiCaps.Add(new PinHdp()
                    {
                        Hdp = spread.Hdp.ToString(), Home = spread.Home.ToString(), Away = spread.Away.ToString()
                    });
                }
            }

            return(data);
        }
        public void AddEvent(OddEvent oddEvent)
        {
            PinData pinData = this.ConvertOddEventToPinData(oddEvent);

            this.Add(pinData);
        }
 public void Add(PinData data)
 {
     this.Data.InsertOne(data);
 }