private void btnAddSubject_Click(object sender, RoutedEventArgs e) { try { AddSubjectWindow addSubjectWindow = new AddSubjectWindow(); if (addSubjectWindow.ShowDialog() == true) { Subject subject = new Subject(); subject.Name = addSubjectWindow.SubjectName; subject.TeacherId = addSubjectWindow.TeacherId; client.AddSubject(subject); UpdateSubjectViews(); MessageBox.Show("Предметът беше добавен успешно"); } } catch (Exception ex) { MessageBox.Show(Application.Current.Resources["defaultErrorMessage"].ToString(), "Грешка", MessageBoxButton.OK, MessageBoxImage.Error); } }