Ejemplo n.º 1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (StackAdd.Children.OfType <TextBox>().Any(x => x.Text == ""))
     {
         MessageBox.Show("Заполните все поля");
         return;
     }
     try
     {
         Stadium.Photo = BArray;
         Connection.NewInstance().StadiumT.Add(Stadium);
         Connection.NewInstance().SaveChanges();
     }
     catch
     {
         MessageBox.Show("12");
     }
     finally
     {
         DataContext       = null;
         Stadium           = new StadiumT();
         PhotoImage.Source = null;
         BArray            = null;
         StackAdd.Children.OfType <TextBox>().ToList().ForEach(x => x.Text = "");
         DataContext = this;
     }
 }
Ejemplo n.º 2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Stadium = DeleteComboBox.SelectedItem as StadiumT;
         Connection.NewInstance().StadiumT.Remove(Stadium);
         Connection.NewInstance().SaveChanges();
     }
     catch
     {
         MessageBox.Show("Выберите стадион для удаления и проверьте что на нем не играют команды");
     }
     finally
     {
         Stadiums = Connection.NewInstance().StadiumT.ToList();
         DeleteComboBox.SelectedIndex = -1;
         DeleteComboBox.ItemsSource   = Stadiums;
     }
 }
Ejemplo n.º 3
0
 public CreateStadium()
 {
     InitializeComponent();
     Stadium     = new StadiumT();
     DataContext = this;
 }
Ejemplo n.º 4
0
 private void StadiumComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Stadium = StadiumComboBox?.SelectedItem as StadiumT;
 }