private void UpdateRecipeExecute()
 {
     if (User.UserID == Recipe.UserID || User.UserName == "Admin")
     {
         UpdateRecipeView view = new UpdateRecipeView(Recipe, User);
         view.ShowDialog();
         AllRecipes = GetAllRecipes();
     }
     else
     {
         MessageBox.Show("You can not Update Recipe that you did not create");
     }
 }
示例#2
0
 private void UpdateRecipeExecute()
 {
     try
     {
         using (CookbookDatabaseEntities1 context = new CookbookDatabaseEntities1())
         {
             tblRecipe        recipeToUpdate = ConvertTotblRepcipe(Recipe);
             UpdateRecipeView recipeView     = new UpdateRecipeView(recipeToUpdate, User);
             recipeView.ShowDialog();
             RecipeList = recipeService.GetAllvwRecipes();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception" + ex.Message.ToString());
     }
 }