コード例 #1
0
        public async Task <ActionResult> ShowRecipe(int Id)
        {
            var recipe = await Helpers.CookBookReciver.GetRecipeById(Id);

            var viewModel = ViewModelMapper.MapToViewModel(recipe);

            return(View("RecipeView", viewModel));
        }
コード例 #2
0
        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));
        }