public AddCourseWindow() { InitializeComponent(); course = new BE.Course(); bl = BL.FactoryBL.GetBL(); this.CourseDetailsGrid.DataContext = course; }
private void addButton_Click(object sender, RoutedEventArgs e) { try { // course.CourseId = int.Parse(this.idTextBox.Text); // course.CourseName = this.nameTextBox.Text; bl.AddCourse(course); course = new BE.Course(); this.CourseDetailsGrid.DataContext = course; // this.idTextBox.ClearValue(TextBox.TextProperty); // this.idTextBox.Text = "" // this.nameTextBox.ClearValue(TextBox.TextProperty);// this.nameTextBox.Text = "" } catch (FormatException) { MessageBox.Show("check your input and try again"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }