public JsonTeamResult GetTeams()
        {
            var            url   = "http://api.football-data.org/v2/competitions/EC/teams";
            JsonTeamResult teams = _download_serialized_json_data <JsonTeamResult>(url);

            return(teams);
        }
        public ActionResult Index()
        {
            FootballApiClient    client            = new FootballApiClient();
            JsonGroupStageResult groupStageMatches = client.GetGroupStageMatches();
            JsonTeamResult       teams             = client.GetTeams();
            AdminViewModel       viewModel         = new AdminViewModel(teams, groupStageMatches);

            return(View(viewModel));
        }
Exemple #3
0
        public ActionResult Index(string userName)
        {
            FootballApiClient    client            = new FootballApiClient();
            JsonGroupStageResult groupStageMatches = client.GetGroupStageMatches();
            JsonTeamResult       teams             = client.GetTeams();

            MyPageViewModel currentGamlePage = new MyPageViewModel(teams, groupStageMatches, userName);

            return(View(currentGamlePage));
        }
 public MyPageViewModel(JsonTeamResult teams, JsonGroupStageResult groupStageMatches, string userName)
 {
     Teams          = TournamentUtility.CreateTeamList(teams);
     CurrentUser    = System.Web.HttpContext.Current.User.Identity.Name;
     HasBetted      = UserManager.HasBetted(CurrentUser);
     Matches        = TournamentUtility.CreateMatchList(groupStageMatches);
     Bet            = new Bet(groupStageMatches);
     Result         = ResultsInVMyPage();
     CurrentUserBet = GetBetForCurrentUser(CurrentUser);
     OtherUsersBet  = GetOtherUsersBet();
     ResultList     = GetResultList(CurrentUserBet);
     UserBet        = GetBetForCurrentUser(userName);
     OtherBet       = userName != null;
     UserName       = userName + "s";
 }