示例#1
0
 public EditIngredientsViewModel(EditIngredientsView editIngredientsOpen, vwRecipe recipeCreated)
 {
     editIngredients     = editIngredientsOpen;
     Recipe              = recipeCreated;
     Ingredient          = new vwIngredient();
     ingredient.RecipeId = recipeCreated.RecipeId;
     IngredientList      = ingredients.GetRecipeIngredients(Recipe);
 }
 private void EditIngredientsExecute()
 {
     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
         {
             EditIngredientsView editIngredients = new EditIngredientsView(Recipe);
             editIngredients.ShowDialog();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }