コード例 #1
0
 private void DeleteClinicMaintenanceExecute()
 {
     try
     {
         if (RecipesData.Recipe != null)
         {
             ShouldDeleteView deleteOrder = new ShouldDeleteView();
             deleteOrder.lblText.Content = "Are you sure you want to delete this recipe?";
             deleteOrder.ShowDialog();
             if ((deleteOrder.DataContext as ShouldDeleteViewModel).ShouldDelete == true)
             {
                 bool isRemovedRecipe = db.TryRemoveRecipe(RecipesData.Recipe.RecipeID);
                 if (isRemovedRecipe == true)
                 {
                     MessageBox.Show("You have successfully deleted the recipe.");
                     RecipesData.Recipes = db.LoadRecipes();
                 }
                 else
                 {
                     MessageBox.Show("Something went wrong. The recipe is not deleted.");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 public ShouldDeleteViewModel(ShouldDeleteView deleteView)
 {
     this.deleteView = deleteView;
 }