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(); }
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); }
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); }