public static Player LastSeason(int peopleId) { using (var db = new CSBCDbContext()) { var rep = new PlayerRepository(db); var player = rep.GetLastSeasonPlayed(peopleId); return player; } }
public void GetLastSeasonPlayedTest() { var rep = new PlayerRepository(new CSBCDbContext()); var season = rep.GetLastSeasonPlayed(2); Assert.IsTrue(season.SeasonID > 0); }
private Player GetPlayerInfo(int seasonId, int peopleId) { var rep = new PlayerRepository(new CSBCDbContext()); var player = rep.GetPlayerByPersonAndSeasonId(peopleId, seasonId); if (player == null) { //if none found get last season var newSeason = rep.GetLastSeasonPlayed(peopleId); //need to call something! } FillPlayerFields(player); return player; }