@page "/teams/goals"
@attribute [Authorize]
@using Microsoft.EntityFrameworkCore
@using WebApp.Models
@using WebApp.Components.Shared.Components
@using Core.Utility
@inject IConfiguration Configuration
@inject AppDbContext Context
@if (_students == null)
{
Loading...
}
else
{
@foreach (var student in _students)
{
@student.Name
For each of your events, write down your goals for this competition year.
@foreach (var team in student.Teams.OrderBy(t => t.Event.Name))
{
@team.Event.Name
@if (team.Event.EventFormat == EventFormat.Team)
{
(Team: @TeamStudentNameFormatter.FormatStudentList(
team,
new TeamStudentNameFormatter.FormatOptions
{
Ordering = TeamStudentNameFormatter.OrderingStyle.GradeDescending
}))
}
Goal:
}
}
}
@code {
private Student[]? _students;
protected override async Task OnInitializedAsync()
{
_students =
await Context.Students
.Include(e => e.Teams)
.ThenInclude(e => e.Event)
.Include(e => e.Teams)
.ThenInclude(e => e.Students)
.OrderBy(e => e.FirstName)
.ToArrayAsync();
}
}