private void SaveExecute() { try { MessageBoxResult result = MessageBox.Show("Are you sure you want to save edits to the recipe?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { recipe.type = selectedType; recipe.authorId = author.userId; service.AddRecipe(recipe); tblRecipe editedRecipe = service.AddRecipe(recipe); MessageBox.Show("Recipe has been edited."); editView.Close(); MessageBoxResult result2 = MessageBox.Show("Do you want to change ingredients too?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result2 == MessageBoxResult.Yes) { EditIngredients editIngredients = new EditIngredients(editedRecipe); editIngredients.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public EditIngredientsViewModel(EditIngredients editOpen, tblRecipe recipeForEdit) { editIngView = editOpen; recipe = recipeForEdit; Ingredient = new tblIngredient(); ingredient.recipeId = recipeForEdit.recipeId; IngredientList = service.AllIngredientForRecipe(recipe.recipeId); }