Ejemplo n.º 1
0
        public IActionResult Index([FromServices] IStandingsService standingsService)
        {
            var model = new StandingsModel(standingsService);

            model.CalculateStandings();
            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task UpdateStandings()
        {
            await StandingsModel.UpdateModelStandings();

            StandingsListViewRecords.Clear();
            for (int i = 0; i < Standings.StandingsVsBot.Count; i++)
            {
                bool isMe = Standings.StandingsVsBot[i].UserName == UserLogin;
                StandingsListViewRecords.Add(new StandingViewCellElement(Standings.StandingsVsBot[i], i + 1, isMe));
            }
            ManVsBot = new StandingViewCellElement(Standings.ManVsBot, -1, false);
        }
Ejemplo n.º 3
0
        private async Task <bool> apiCall()
        {
            string[] matchPaths    = { "v2/competitions/CL/matches", "v2/competitions/PL/matches", "v2/competitions/PD/matches" };
            string[] teamPaths     = { "v2/competitions/CL/teams", "v2/competitions/PL/teams", "v2/competitions/PD/teams" };
            string[] standingPaths = { "v2/competitions/CL/standings", "v2/competitions/PL/standings", "v2/competitions/PD/standings" };
            string[] scorerPaths   = { "v2/competitions/CL/scorers", "v2/competitions/PL/scorers", "v2/competitions/PD/scorers" };

            IEnumerable <MatchesModel> matches = await ApiMatchModelAsync(matchPaths);

            IEnumerable <TeamsModel> teams = await ApiTeamModelAsync(teamPaths);

            IEnumerable <StandingsModel> standings = await ApiStandingModelAsync(standingPaths);

            IEnumerable <ScorerModel> scorers = await ApiScorerModelAsync(scorerPaths);

            clMatches = matches.Where(match => match.competition.id == 2001).FirstOrDefault();
            plMatches = matches.Where(match => match.competition.id == 2021).FirstOrDefault();
            pdMatches = matches.Where(match => match.competition.id == 2014).FirstOrDefault();

            allMatch.AddRange(clMatches.matches);
            allMatch.AddRange(plMatches.matches);
            allMatch.AddRange(pdMatches.matches);

            clTeams = teams.Where(team => team.competition.id == 2001).FirstOrDefault();
            plTeams = teams.Where(team => team.competition.id == 2021).FirstOrDefault();
            pdTeams = teams.Where(team => team.competition.id == 2014).FirstOrDefault();

            allTeams.AddRange(clTeams.teams);
            allTeams.AddRange(plTeams.teams);
            allTeams.AddRange(pdTeams.teams);

            clStanding = standings.Where(standing => standing.competition.id == 2001).FirstOrDefault();
            plStanding = standings.Where(standing => standing.competition.id == 2021).FirstOrDefault();
            pdStanding = standings.Where(standing => standing.competition.id == 2014).FirstOrDefault();

            clScorers = scorers.Where(scorer => scorer.competition.id == 2001).FirstOrDefault();
            plScorers = scorers.Where(scorer => scorer.competition.id == 2021).FirstOrDefault();
            pdScorers = scorers.Where(scorer => scorer.competition.id == 2014).FirstOrDefault();

            return(true);
        }
Ejemplo n.º 4
0
        private List <StandingsModel> processStandings(IDocument response)
        {
            var       standings = new List <StandingsModel>();
            IDocument document  = response;
            var       tables    = document.QuerySelectorAll(".FTable");

            foreach (var table in tables)
            {
                var Standing  = new StandingsModel();
                var headerRow = table.QuerySelector(".FHeader");
                Standing.Date = headerRow.QuerySelector("td").TextContent;
                var matches = table.QuerySelectorAll(".FRow");
                foreach (var match in matches)
                {
                    var matchModel = new MatchModel();
                    matchModel.Time = match.QuerySelector(".FDate").TextContent;
                    try {
                        matchModel.TeamA     = match.QuerySelector(".FHomeTeam").TextContent;
                        matchModel.TeamAHref = match.QuerySelector(".FHomeTeam").QuerySelector("a").GetAttribute("href");

                        matchModel.TeamB     = match.QuerySelector(".FAwayTeam").TextContent;
                        matchModel.TeamBHref = match.QuerySelector(".FAwayTeam").QuerySelector("a").GetAttribute("href");

                        matchModel.Court = match.QuerySelector(".FPlayingArea").TextContent;

                        matchModel.Score     = Extensions.Purify(match.QuerySelector(".FScore").TextContent);
                        matchModel.ScoreHref = match.QuerySelector(".FScore").QuerySelector("a").GetAttribute("href");
                    }
                    catch (Exception ex) {
                    }

                    Standing.Matches.Add(matchModel);
                }
                standings.Add(Standing);
            }
            return(standings);
        }
Ejemplo n.º 5
0
        public virtual ActionResult Index()
        {
            StandingsModel model = _standingsModelBuilder.BuildModel();

            return(View(model));
        }
Ejemplo n.º 6
0
 public StandingsDisplayData(INavigation navigation)
 {
     StandingsModel = new StandingsModel();
     Navigation     = navigation;
     RefreshList();
 }