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(); }
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)); }