public async Task <List <Statistics> > GetStatisticsForCountryAsync(string country, DateTime day) { var query = string.Format(_statisticsRoute, day.ToString("yyyy-MM-dd"), country); var result = await _securedServiceClient.GetAsync <ResponseWrapper <List <StatisticsResponse> > >(query).ConfigureAwait(false); return(StatisticsMapper.Map(result.Response)); }
/// <summary> /// Initializes a new instance of the <see cref="AsyncServerClient"/> class. /// </summary> /// <param name="url">The URL.</param> /// <param name="convention">The convention.</param> /// <param name="credentials">The credentials.</param> public AsyncServerClient(string url, DocumentConvention convention, ICredentials credentials) { Guard.Assert(() => !string.IsNullOrEmpty(url)); Guard.Assert(() => convention != null); WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp); DatabaseAddress = new Uri(url); Convention = convention; Credentials = credentials; ContextStorage = new Dictionary<HttpJsonRequest, SynchronizationContext>(); DocumentMapper = new DocumentMapper(); IndexMapper = new IndexMapper(Convention); AttachmentMapper = new AttachmentMapper(); StatisticsMapper = new StatisticsMapper(); QueryResultMapper = new QueryResultMapper(); }
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(); } }