public async Task InitAsync(int? id) { Teams = await Repository.Teams .Where(x => x.ShowInMenu) .OrderBy(x => x.Sortorder) .ToArrayAsync(); Team = Teams.FirstOrDefault(x => !id.HasValue || x.Id == id); if (Team == null) { throw new HttpException(404, "Page not found"); } await Repository.LoadPlayersAsync(Team); }
public async Task LoadPlayersAsync(Team team) { await Context.Entry(team).Collection(x => x.Players).LoadAsync(); }