예제 #1
0
        public async Task<ActionResult<IEnumerable<object>>> Get([FromQuery] string query)
        {
            if (query.Length < 3)
                return BadRequest("Length must be greater than 3 chars");
            var result = await _searchApiClient.GetSearch(query);
            if (result.Any())
                return Ok(result);
            return NoContent();

        }
예제 #2
0
        public async Task <IActionResult> Search(string keyword)
        {
            var searchViewModel = new List <SearchViewModel>();
            var searchResult    = await _searchApiClient.GetSearch(keyword);

            if (searchResult != null)
            {
                searchResult.ForEach(searchDoc =>
                {
                    var advertViewModel = _mapper.Map <SearchViewModel>(searchDoc);
                    searchViewModel.Add(advertViewModel);
                });
            }

            return(View("Search", searchViewModel));
        }