Esempio n. 1
0
        public AddEditTeacherWindow(Teacher p_teacher = null)
        {
            InitializeComponent();
            instance = this;

            teacher = p_teacher;

            if (teacher != null)
            {
                btnAddTeacher.Content = "Edit teacher";
                txtName.Text          = teacher.Fullname;
            }
        }
        private void btnCreateTeacher_Click(object sender, RoutedEventArgs e)
        {
            AddEditTeacherWindow addEditTeacherWindow = new AddEditTeacherWindow();

            addEditTeacherWindow.ShowDialog();

            if (addEditTeacherWindow.GetTeacher() != null)
            {
                teachersManagment.Insert(addEditTeacherWindow.GetTeacher());
                teachersManagment.SaveChanges();

                UpdateTeachers();
            }
        }