private void AddIngredientsExecute() { if (String.IsNullOrEmpty(Recipe.RecipeName) || String.IsNullOrEmpty(Recipe.Type) || String.IsNullOrEmpty(Recipe.NumberOfPersons.ToString()) || Recipe.NumberOfPersons == 0 || String.IsNullOrEmpty(Recipe.Description)) { MessageBox.Show("Please fill all fields.", "Notification"); } else { try { recipes.CreateRecipe(Recipe, out int id); Recipe.RecipeId = id; AddIngredientsView addIngredients = new AddIngredientsView(Recipe); addRecipe.Close(); addIngredients.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }