Mitarbeit bewerten begonnen, Schülerdaten, Gruppen

This commit is contained in:
2026-06-23 10:12:52 +02:00
parent fdbaa9ef4d
commit b2211270b4
32 changed files with 1968 additions and 49 deletions
@@ -1,3 +1,35 @@
using Avalonia.Controls;
using LehrerApp.Core.Interfaces;
using LehrerApp.Desktop.ViewModels.Groups;
using Microsoft.Extensions.DependencyInjection;
namespace LehrerApp.Desktop.Views.Groups;
public partial class GroupDetailView : UserControl { public GroupDetailView() => InitializeComponent(); }
public partial class GroupDetailView : UserControl
{
public GroupDetailView() => InitializeComponent();
protected override void OnDataContextChanged(EventArgs e)
{
base.OnDataContextChanged(e);
if (DataContext is GroupDetailViewModel vm)
vm.OnAddStudent = ShowAddStudentDialog;
}
private async Task<bool> ShowAddStudentDialog()
{
if (DataContext is not GroupDetailViewModel vm || vm.Group is null) return false;
var dialogVm = new AddStudentToGroupDialogViewModel(
App.Services.GetRequiredService<IStudentRepository>(),
App.Services.GetRequiredService<IEnrollmentRepository>(),
vm.Group.Id,
vm.Group.SchoolYear);
var dialog = new AddStudentToGroupDialog { DataContext = dialogVm };
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is null) return false;
return await dialog.ShowDialog<bool>(owner);
}
}