public ActionResult Ingredient(int ingredientId) { var ingredient = _ingredientRepository.Get(ingredientId); if (!ingredient.Any()) { ViewBag.Error = "Cannot find ingredient"; return(View(new RemoveIngredientModel())); } var pizzas = _pizzaRepository.GetAllByIngredient(ingredientId); var ingr = ingredient.Single(); var model = new RemoveIngredientModel { IngredientId = ingr.IngredientId, IngredientName = ingr.Name, PizzasWithIngredient = pizzas }; return(View(model)); }