Ejemplo n.º 1
0
        private void DeleteTestFromGroup_Click(object sender, RoutedEventArgs e)
        {
            var dg = sender as DataGrid;

            for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual)
            {
                if (vis is DataGridRow)
                {
                    if (((System.Windows.FrameworkElement)vis).DataContext is TestViewModel)
                    {
                        var testId = ((DTO.TestViewModel)((System.Windows.FrameworkElement)vis).DataContext).TestId;
                        if (testId != -1)
                        {
                            string answer = client.DeleteTestFromGroup(testId, dtoGroup.GroupId);
                            if (answer == "succesfull")
                            {
                                main.Content = new AdminStudentGroups(client, mw, main);
                            }
                        }
                    }
                }
            }
        }