Пример #1
0
        public IActionResult Get()
        {
            var recipeList = _recipeData.GetRecipeByName("");
            var result     = _mapper.Map <ApiRecipe[]>(recipeList);

            return(Ok(result));
        }
Пример #2
0
        public IActionResult Index(int?page, string sortBy)
        {
            var recipes = _recipeData.GetRecipeByName("").ToList();

            if (!page.HasValue)
            {
                page = 1;
            }

            if (string.IsNullOrWhiteSpace(sortBy))
            {
                sortBy = "name";
            }

            var viewModel = new RecipeListViewModel
            {
                Recipes = recipes,
                Page    = page.Value,
                SortBy  = sortBy
            };

            return(View(viewModel));
        }
Пример #3
0
 public void OnGet()
 {
     Recipes = recipeData.GetRecipeByName(SearchTerm);
 }