Example #1
0
        private static void AddMatchIds(int bucketTime)
        {
            using (var riotDb = new RiotDataContext())
            {
                foreach (var matchId in MatchIds)
                {
                    if (!riotDb.Matches.Any(m => m.MatchId == matchId))
                    {
                        riotDb.Matches.InsertOnSubmit(new Match {
                            BucketTime = bucketTime, MatchId = matchId
                        });
                    }
                }

                riotDb.SubmitChanges();
            }
        }
Example #2
0
        private static void AddMatchData(List <Match> matches, RiotDataContext riotDb)
        {
            Console.WriteLine("Updating {0} matches.", matches.Count());

            foreach (var match in matches)
            {
                var matchData    = RiotService.MatchService(match.MatchId);
                var currentMatch = riotDb.Matches.First(m => m.MatchId == match.MatchId);
                currentMatch.AddMatchData(matchData);

                foreach (var participant in matchData.Participants)
                {
                    var stats = StatisticsMapper.MapParticipantStat(participant.Statistics);
                    currentMatch.Participants.Add(ParticipantMapper.MapParticipant(matchData, participant, stats));
                }

                foreach (var team in matchData.Teams)
                {
                    currentMatch.Teams.Add(TeamMapper.MapTeam(team));
                }

                riotDb.SubmitChanges();
            }
        }