private void DeleteRecipeIngredient(object obj) { if (selectedRecipeIngredient != null) { if (MessageBox.Show("Do you want to delete the selected recipe ingredient?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes) { if (dbActions.DeleteRecipeIngredient(new CookBookData.Model.RecipeIngredient { Id = selectedRecipeIngredient.Id })) { ingredientItems.Remove(selectedRecipeIngredient); } } } }