public async Task <ActionResult> Index() { var allRecipes = await Helpers.CookBookReciver.GetAllRecipes(); var allIngredients = await CookBookData.GetIngredientsCollection(); ViewBag.Ingredients = allIngredients.Select(i => i.Name); _recipesPartialViewModel.RecipesList = ViewModelMapper.MapToViewModel(allRecipes); _recipesPartialViewModel.RecipeTobeAdded = Templates.RecipeToBeAddedTemplate; return(View(_recipesPartialViewModel)); }
public static int GetIngredientId(string ingredientName) { return(CookBookData.GetIngredientIdByName(ingredientName).Id); }