//Remove MealIngredient from Meal public ActionResult RemoveMealIngredient(int id) { var MealDBInterface = new MealDAO(); var ingredientToDelete = MealDBInterface.FetchMealIngredient(id); var mealId = ingredientToDelete.MealId; MealDBInterface.DeleteMealIngredient(id); var mealToDisplay = new MealViewModel(); mealToDisplay = MealDBInterface.FetchMeal(mealId); return(View("MealForm", mealToDisplay)); }
//Edit MealIngredient public ActionResult ProcessIngredientToEdit(int id) { var MealDBInterface = new MealDAO(); var mealIngredientToEdit = new MealIngredientViewModel(); mealIngredientToEdit = MealDBInterface.FetchMealIngredient(id); var unitLabels = new List <Unit>(); unitLabels = MealDBInterface.FetchUnits(); mealIngredientToEdit.AvailableUnitLabels = unitLabels; return(View("MealIngredientForm", mealIngredientToEdit)); }