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); }
public PlayersRepository(TennisTrackerContext dbContext) { _entities = dbContext; }
public SinglesMatchRepository(TennisTrackerContext dbContext) { _entities = dbContext; }
public SinglesMatchRepository(TennisTrackerContext dbContext) { _entities = dbContext; }
public PlayersRepository(TennisTrackerContext dbContext) { _entities = dbContext; }