Details Lerngruppe, Archiv, Stub Import

This commit is contained in:
2026-08-11 17:54:10 +02:00
parent 7a1f89cd4a
commit fd715dd5a5
11 changed files with 281 additions and 40 deletions
@@ -12,7 +12,11 @@ public partial class GroupListView : UserControl
{
base.OnDataContextChanged(e);
if (DataContext is GroupListViewModel vm)
{
vm.OnAddGroup = ShowAddGroupDialog;
vm.OnEditGroup = ShowEditGroupDialog;
vm.OnConfirmDelete = ShowDeleteGroupDialog;
}
}
private async Task ShowAddGroupDialog()
@@ -23,4 +27,25 @@ public partial class GroupListView : UserControl
if (owner is not null)
await dialog.ShowDialog(owner);
}
private async Task ShowEditGroupDialog(Guid groupId)
{
var group = App.Services.GetRequiredService<LehrerApp.Core.Interfaces.IGroupRepository>()
.GetById(groupId);
if (group is null) return;
var dialogVm = App.Services.GetRequiredService<AddGroupDialogViewModel>();
dialogVm.LoadForEdit(group);
var dialog = new AddGroupDialog { DataContext = dialogVm };
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is not null)
await dialog.ShowDialog<bool>(owner);
}
private async Task<bool> ShowDeleteGroupDialog(GroupListItem group)
{
var dialog = new DeleteGroupDialog { DataContext = group.DisplayName };
var owner = TopLevel.GetTopLevel(this) as Window;
return owner is not null && await dialog.ShowDialog<bool>(owner);
}
}