//Deleting a saved recipe from the database and returning back to the saved recipe view public async Task <IActionResult> DeleteSavedRecipe(SavedRecipeListViewModel recipeInfo) { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var isRecipeDeleted = false; if (recipeInfo.CustomeRecipeId == null) { isRecipeDeleted = await _repositoryClient.DeleteRecipe(userId, recipeInfo.RecipeId, null); } else { isRecipeDeleted = await _repositoryClient.DeleteRecipe(userId, null, recipeInfo.CustomeRecipeId); } if (isRecipeDeleted) { return(RedirectToAction("SavedRecipeList", "Recipe")); } else { return(RedirectToAction("Error", "Home")); } }