public ActionResult View(int id) { RecipeViewModel model = new RecipeViewModel(repo.GetByID(id)); IngredientRepository ingredientRepository = new IngredientRepository(); List <Ingredient> ingredients = new List <Ingredient>(); foreach (IngredientLink link in model.Ingredients) { ingredients.Add(ingredientRepository.GetByID(link.IngredientID)); } ViewBag.Ingredients = ingredients; return(View(model)); }
public Recipe Get(int id) { return(RecipeRepository.GetByID(id)); }