예제 #1
0
        private void AddStudent_Click(object sender, EventArgs e)
        {
            //var student = new Model.Student { Name = "Test", Admission = DateTime.Now, GroupId = 0 };

            var newStudentDialog = new NewStudent();

            if (newStudentDialog.ShowDialog() == true)
            {
                var student = (Model.Student)(newStudentDialog.FindResource("studentViewSource"));
                db.Students.Add(student);
            }
        }
예제 #2
0
        private void AddStudent_Click(object sender, EventArgs e)
        {
            if (db.Groups.Local.Count == 0)
            {
                MessageBox.Show("Создайте группу", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }


            var newStudentDialog = new NewStudent();

            if (newStudentDialog.ShowDialog() == true)
            {
                var student = (Model.Student)(newStudentDialog.FindResource("studentViewSource"));
                db.Students.Add(student);
            }
        }