Пример #1
0
        public ActionResult SearchFormPost(string id, string db, string language, string query)
        {
            var results    = WebSearchService.WebSearch(query, 10, "en-US", SafeSearchOptions.Strict);
            var returnList = results?.WebPages?.Value?.Select(a => new SearchResult {
                Title = a.Name, Url = a.DisplayUrl, Description = a.Snippet
            }) ?? new List <SearchResult>();

            return(Json(new
            {
                Failed = false,
                Items = returnList
            }));
        }
Пример #2
0
        public ActionResult GetWebSearch(string text)
        {
            var results = WebSearchService.WebSearch(text);

            return(Json(results.WebPages.Value));
        }