Neue Funktion Schüler austragen statt aus Kurs löschen.
This commit is contained in:
@@ -17,6 +17,7 @@ public partial class GroupDetailView : UserControl
|
||||
if (DataContext is GroupDetailViewModel vm)
|
||||
{
|
||||
vm.OnAddStudent = ShowAddStudentDialog;
|
||||
vm.OnWithdrawStudent = ShowWithdrawStudentDialog;
|
||||
vm.OnAddExam = ShowAddExamDialog;
|
||||
vm.OnEditExam = ShowEditExamDialog;
|
||||
vm.OnDuplicateExam = ShowDuplicateExamDialog;
|
||||
@@ -42,6 +43,20 @@ public partial class GroupDetailView : UserControl
|
||||
return await dialog.ShowDialog<bool>(owner);
|
||||
}
|
||||
|
||||
private async Task<bool> ShowWithdrawStudentDialog(StudentSummary student)
|
||||
{
|
||||
if (DataContext is not GroupDetailViewModel vm || vm.Group is null) return false;
|
||||
var memberships = App.Services.GetRequiredService<IGroupMembershipRepository>();
|
||||
var membership = memberships.GetByStudentAndGroup(student.Id, vm.Group.Id);
|
||||
if (membership is null) return false;
|
||||
|
||||
var dialogVm = new WithdrawStudentDialogViewModel(
|
||||
memberships, membership, student.FullName, vm.Group.Name);
|
||||
var dialog = new WithdrawStudentDialog { DataContext = dialogVm };
|
||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||
return owner is not null && await dialog.ShowDialog<bool>(owner);
|
||||
}
|
||||
|
||||
private Task<bool> ShowAddExamDialog(Guid groupId) =>
|
||||
ShowExamDialog(groupId, editingExam: null, duplicateSource: null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user