コード例 #1
0
 public SummonersController(ApplicationDbContext context)
 {
     // Context only used for Identity right now. Eventually, will save summoner data
     // to DB after requests complete, so we can check that first before calling API.
     _context         = context;
     _championMastery = new Champion_Mastery_V4("na1");
     _allChamps       = _championMastery.GetAllChampions();
 }
コード例 #2
0
        public MasteryResponse GetChampionList()
        {
            MasteryResponse response = new MasteryResponse();

            using (StreamReader r = File.OpenText("C:/Users/James/source/repos/MyLeagueDashboard/Data/ExampleChampion.json"))
            {
                string  json           = r.ReadToEnd();
                JObject championSearch = JObject.Parse(json);
                //IList<JToken> results = championSearch["data"].Children().ToList();
                response = championSearch.ToObject <MasteryResponse>();
                //list.Champions = dict;
            }
            return(response);
        }
コード例 #3
0
        public MasteryResponse GetAllChampions()
        {
            MasteryResponse response = new MasteryResponse();
            var             resp     = GET(GetChampionURI());
            string          content  = resp.Content.ReadAsStringAsync().Result;

            if (resp.StatusCode == System.Net.HttpStatusCode.OK)
            {
                Console.Write("Return good");
                response = JsonConvert.DeserializeObject <MasteryResponse>(content);
            }
            else
            {
                Console.Write("Return bad");
                return(null);
            }
            return(response);
        }