Beispiel #1
0
        public SpoonacularResponseModel AskQuestion(string search)
        {
            try
            {
                //var searchEngine = DIExtensions.GetServiceByType(_httpContext.RequestServices.GetServices<ISearch>(), typeof(SearchEngine));
                SearchEngine searchEngine = new SearchEngine(_config, _loggerFactory, _httpClientFactory);
                var          recipes      = searchEngine.AskQuestion(search);

                return(recipes);
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Failed to find food!");
                return(new SpoonacularResponseModel());
            }
        }