private void Button_Click(object sender, RoutedEventArgs e) { ComputerClub db = new ComputerClub(); pc.Name = TextBoxName.Text; if (StatusComboBox.SelectedIndex == -1) { MessageBox.Show("Укажите Статус под именем."); } else if (StatusComboBox.SelectedIndex == 0) { pc.StatusId = 1; } else if (StatusComboBox.SelectedIndex == 1) { pc.StatusId = 2; } else if (StatusComboBox.SelectedIndex == 2) { pc.StatusId = 3; } else { MessageBox.Show("Укажите Статус под именем."); } db.SaveChanges(); DialogResult = true; }
private void Button_Click(object sender, RoutedEventArgs e) { ComputerClub db = new ComputerClub(); PC pc = new PC(); pc.Name = TextBoxName.Text; pc.StatusId = 1; db.PCs.Add(pc); db.SaveChanges(); DialogResult = true; }
public MainViewModel() { try { db = new ComputerClub(); } catch (Exception ex) { MessageBox.Show(ex.Message); } Times.Add(30); Times.Add(60); Times.Add(90); Times.Add(120); }