public async Task LoadRanksAsync(Season season) { await Context.Entry(season) .Collection(x => x.Ranks) .Query() .Include(x => x.Team) .OrderByDescending(x => x.Percentage) .LoadAsync(); }
public async Task LoadGamesAsync(Season season) { await Context.Entry(season) .Collection(x => x.Games) .Query() .Include(x => x.Home) .Include(x => x.Away) .LoadAsync(); }
public async Task InitAsync(int? id) { Competitions = await Repository.Competitions .Include(x => x.Seasons) .ToArrayAsync(); Competition = Competitions.FirstOrDefault(x => !id.HasValue || x.Id == id); if (Competition == null) { throw new HttpException(404, "Page not found"); } Season = Competition.Seasons.FirstOrDefault(); if (Season == null) { throw new HttpException(404, "Page not found"); } await Repository.LoadGamesAsync(Season); await Repository.LoadRanksAsync(Season); }