Esempio n. 1
0
        public ActionResult Index()
        {
            var dbContext = new TennisTrackerContext();
            var singlesMatchRespotiory = new SinglesMatchRepository(dbContext);

            _singlesMatchRepository = singlesMatchRespotiory;

            var singlesMatches =
                _singlesMatchRepository.GetAllSinglesMatches();

            return(View(singlesMatches));
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            var dbContext = new TennisTrackerContext();

            _playerRepository = new PlayersRepository(dbContext);
            var players = _playerRepository.GetAllPlayers();
            var singlesMatchRepository = new SinglesMatchRepository(dbContext);
            var singlesMatchService    = new SinglesMatchService(singlesMatchRepository);

            var winLossDictionary = new List <Dictionary <int, string> >();

            foreach (var player in players)
            {
                var winLoss =
                    singlesMatchService.CalculateWinLoss(player.PlayerId);
                winLossDictionary.Add(winLoss);
            }

            var playersWithWinLoss = new PlayersWithWinLoss(players, winLossDictionary);

            return(View(playersWithWinLoss));
        }