Ejemplo n.º 1
0
 private void buttAddPlant_Click(object sender, RoutedEventArgs e)
 {
     if (tbcname.Text != "" && tblname.Text != "" && tbimgurl.Text != "" && tbdesc.Text != "" && tbsdays.Text != "")
     {
         MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure?", "Addition Confirmation", MessageBoxButton.YesNo);
         if (messageBoxResult == MessageBoxResult.Yes)
         {
             int check = service.AddPlant(tbcname.Text, tblname.Text, tbimgurl.Text, tbdesc.Text, int.Parse(tbsdays.Text));
             if (check != 0)
             {
                 MessageBox.Show("Plant Added", "Addition Confirmed", MessageBoxButton.OK);
             }
             //Refresh list
             var plantList = service.GetAllPlants();
         }
         this.Close();
         p.ListPlants();
     }
     else
     {
         MessageBoxResult msgBox = MessageBox.Show("Please fill out every information", "Missing information", MessageBoxButton.OK);
     }
 }