private void Button_Click(object sender, RoutedEventArgs e) { Profesores MyProfe = (from m in DbEntityes.Profesores where m.Id == id select m).Single(); MyProfe.Nombre = TxtNombre.Text; MyProfe.Especialidad = cmbEspec.Text; DbEntityes.SaveChanges(); MainWindow.ControlDatagrid.ItemsSource = DbEntityes.Profesores.ToList(); this.Hide(); }
private void Button_Click(object sender, RoutedEventArgs e) { //int idulti = MyDataGrid.Items.Count+1; Profesores MyProfe = new Profesores() { Id = int.Parse(TxtID.Text), Nombre = TxtNombre.Text, Especialidad = cmbEspec.Text }; DbEntityes.Profesores.Add(MyProfe); DbEntityes.SaveChanges(); MainWindow.ControlDatagrid.ItemsSource = DbEntityes.Profesores.ToList(); this.Hide(); }