public ActionResult GetMatchDetails()
        {
            if (User.Identity.Name != "Steven")
            {
                return(View("AuthenticationError"));
            }

            var id           = HttpContext.Request.QueryString["matchId"];
            var confirmation = HttpContext.Request.QueryString["confirmation"] != null;

            var match = Mongo.Matches.FindOne(Query <Match> .Where(x => x.Id == ObjectId.Parse(id)));

            if (confirmation)
            {
                var key        = WebConfigurationManager.AppSettings["RiotTournamentApiKey"];
                var rateLimit1 = int.Parse(WebConfigurationManager.AppSettings["RateLimitPer10Seconds"]);
                var rateLimit2 = int.Parse(WebConfigurationManager.AppSettings["RateLimitPer10Minutes"]);

                var api = TournamentRiotApi.GetInstance(key, rateLimit1, rateLimit2);

                MatchScraper.GetMatchDetails(api, match, false);
                return(RedirectToAction("Matches", "Admin"));
            }

            return(View(match));
        }
Exemplo n.º 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Test code for debugging (Joris + Steven summoner ID's)
            // var code = TournamentCodeFactory.GetTournamentCode(new List<long> {24689119, 26230426, 20893030, 20122308, 19308883, 39609774, 40776930, 21148960, 19977657, 20013452});

#if !DEBUG
            _riotApiScrapeJob = new RiotApiScrapeJob();
            _riotApiScrapeJob.StartTimer();

            _matchScraper = new MatchScraper();
            _matchScraper.StartTimer();
#endif


            //Remove and JsonValueProviderFactory and add JsonDotNetValueProviderFactory
            ValueProviderFactories.Factories.Remove(ValueProviderFactories.Factories.OfType <JsonValueProviderFactory>().FirstOrDefault());
            ValueProviderFactories.Factories.Add(new JsonDotNetValueProviderFactory());
        }