Keep legal first and last names for formal lists; show DisplayFirstName on teams, calendars, and import matching so two Josiahs can be told apart. Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using Core.Entities;
|
|
using Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace WebApp.Services;
|
|
|
|
/// <summary>
|
|
/// Service for loading meeting schedule data from the database.
|
|
/// </summary>
|
|
public class MeetingScheduleDataService : IMeetingScheduleDataService
|
|
{
|
|
private readonly AppDbContext _context;
|
|
|
|
public MeetingScheduleDataService(AppDbContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public async Task<Team[]> LoadTeamsAsync()
|
|
{
|
|
return await _context.Teams
|
|
.AsNoTracking()
|
|
.Include(e => e.Event)
|
|
.Include(e => e.Students)
|
|
.OrderBy(e => e.Event.Name)
|
|
.ThenBy(e => e.Identifier)
|
|
.ToArrayAsync();
|
|
}
|
|
|
|
public async Task<Student[]> LoadStudentsAsync()
|
|
{
|
|
return await _context.Students
|
|
.AsNoTracking()
|
|
.Include(e => e.Teams)
|
|
.ThenInclude(t => t.Event)
|
|
.Include(e => e.Teams)
|
|
.ThenInclude(t => t.Captain)
|
|
.Include(e => e.EventRankings)
|
|
.ThenInclude(e => e.EventDefinition)
|
|
.OrderBy(e => e.Nickname ?? e.FirstName)
|
|
.ToArrayAsync();
|
|
}
|
|
}
|