/// <summary> /// This is used by the Angular controller to request team specific player details /// </summary> public JsonResult GetTeamStanding(string teamStandingUrl) { var client = new RestClient("http://api.football-data.org/v1/competitions/" + teamStandingUrl.ToString() + "/leagueTable"); var request = new RestRequest(Method.GET); request.RequestFormat = DataFormat.Json; var r = client.Execute(request); LeagueStanding model = JsonConvert.DeserializeObject <LeagueStanding>(r.Content); Object response = model.standing; return(Json(response, JsonRequestBehavior.AllowGet)); }
/// <summary> /// This is used to request the league table model which is used to list the /// placement results for the leage(i.e 1st, 2nd, etc) /// </summary> public ActionResult LeagueStandings(int?id) { if (id == null) { return(View("RestrictedAccess")); } else { var client = new RestClient("http://api.football-data.org/v1/competitions/" + id.ToString() + "/leagueTable"); var request = new RestRequest(Method.GET); request.RequestFormat = DataFormat.Json; var response = client.Execute(request); LeagueStanding model = JsonConvert.DeserializeObject <LeagueStanding>(response.Content); return(View(model)); } }