コード例 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Profesores MyProfe = (from m in DbEntity.Profesores where m.Id == id select m).Single();

            MyProfe.Nombre       = TxtNombre.Text;
            MyProfe.Especialidad = cmbEspec.Text;
            DbEntity.SaveChanges();
            MainWindow.ControlDatagrid.ItemsSource = DbEntity.Profesores.ToList();
        }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // int id u l t i = MyDataGrid.Items.Count + 1;
            Profesores MyProfe = new Profesores()
            {
                Id           = int.Parse(TxtID.Text),
                Nombre       = TxtNombre.Text,
                Especialidad = cmbEspec.Text
            };

            DbEntity.Profesores.Add(MyProfe);
            DbEntity.SaveChanges();
            MainWindow.ControlDatagrid.ItemsSource = DbEntity.Profesores.ToList();
            this.Hide();
        }