private void Add_Click(object sender, RoutedEventArgs e) { var dialog = new GroupAddEditDialog(); dialog.Title = "Добавить группу"; if (dialog.ShowDialog() == true) { var group = new Group { Name = dialog.GroupName }; db.Groups.Add(group); UpdateGrid(); } }
private void Edit_Click(object sender, RoutedEventArgs e) { if (Data.SelectedItem == null || Data.SelectedItem as Group == null) { return; } var group = Data.SelectedItem as Group; var dialog = new GroupAddEditDialog(); dialog.Title = "Редактировать группу"; dialog.GroupName = group.Name; if (dialog.ShowDialog() == true) { group.Name = dialog.GroupName; UpdateGrid(); } }