Beispiel #1
0
 private void AddNewIngredientButtonAddRecipe_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(AddNewIngredientTextBoxAddRecipe.Text))
     {
         MessageBox.Show("An ingredient must have a name!");
     }
     else
     {
         var newIngredientToAdd = new Ingredient
         {
             Name = AddNewIngredientTextBoxAddRecipe.Text
         };
         _ingredientsToAdd.Add(newIngredientToAdd);
         _recipeRepository.AddIngredient(newIngredientToAdd);
         AddNewIngredientTextBoxAddRecipe.Clear();
         ExistingIngredientsListBox.DataSource = _recipeRepository.GetAllIngredients();
     }
 }