public async Task <IActionResult> MatchDayScheduling()
        {
            ViewData["Title"] = "Matchday Scheduling";

            var tournament = await fantasySoccerService.GetCurrentTournament();

            var numberOfRounds = await fantasySoccerService.GetNumberOfRoundsForATournament(tournament.ID);

            var matches = await fantasySoccerService.GetMatches(tournament.ID, tournament.CurrentRound);

            var viewModel = new CurrentRoundViewModel
            {
                TournamentId   = tournament.ID,
                TournamentName = tournament.Name,
                CurrentRound   = tournament.CurrentRound,
                NumberOfRounds = numberOfRounds,
                Matches        = matches
            };

            return(View(viewModel));
        }
        public async Task GetMatches_GetMatchesForARound_ReturnTheTwoMatchesForTheRound()
        {
            //arrange
            const int    ROUND         = 1;
            const string TOURNAMENT_ID = "1";

            fakeCosmosDBService.Matches = DataHelper.GetDummyMatches(2, TOURNAMENT_ID, ROUND);

            //act
            var result = await fantasySoccerService.GetMatches(TOURNAMENT_ID, ROUND);

            //assert
            Assert.Equal(2, result.Count());
        }
        public async Task <List <MatchSimulationResult> > SimulateTournamentRound(string tournamentId, int round)
        {
            var matches = await fantasySoccerService.GetMatches(tournamentId, round);

            var matchSimulationResults = new List <MatchSimulationResult>();

            var futbolPlayers = await fantasySoccerService.GetFutbolPlayersStoreAsync();

            var futbolPlayersGroupByTeam = futbolPlayers.PaginatedItems.ToLookup(fp => fp.FutbolTeamID, fp => fp);

            foreach (var match in matches)
            {
                var localTeam   = futbolPlayersGroupByTeam[match.LocalFutbolTeamID];
                var visitorTeam = futbolPlayersGroupByTeam[match.VisitorFutbolTeamID];
                matchSimulationResults.Add(SimulateMatch(match, localTeam.ToList(), visitorTeam.ToList()));
            }

            return(matchSimulationResults);
        }