예제 #1
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);
        }
예제 #2
0
 public PlayersRepository(TennisTrackerContext dbContext)
 {
     _entities = dbContext;
 }
 public SinglesMatchRepository(TennisTrackerContext dbContext)
 {
     _entities = dbContext;
 }
 public SinglesMatchRepository(TennisTrackerContext dbContext)
 {
     _entities = dbContext;
 }
예제 #5
0
 public PlayersRepository(TennisTrackerContext dbContext)
 {
     _entities = dbContext;
 }