protected void Page_Load(object sender, EventArgs e) { using (var db = new CSBCDbContext()) { var repo = new PlayerRepository(db); Players = repo.GetDivisionPlayers(757).ToList(); ObjectDataSource1.DataBind(); } }
public List<SeasonPlayer> GetDivisionPlayers(int divisionId) { using (var db = new CSBCDbContext()) { var rep = new PlayerRepository(db); var players = rep.GetDivisionPlayers(divisionId); return players.ToList(); } }
private void LoadRows(int divisionId) { var rep = new PlayerRepository(new CSBCDbContext()); var players = rep.GetDivisionPlayers(divisionId).ToList<SeasonPlayer>(); grdPlayers.DataSource = players; grdPlayers.DataBind(); }