public async Task <SongSearchResponse> FormattedSongSearch(FormattedSongSearchRequest request) { try { var result = await _searchClient.PostAsync("FormattedSongSearch", HttpClientHelper.GetJsonData(request)); return(JsonConvert.DeserializeObject <SongSearchResponse>(await result.Content.ReadAsStringAsync())); } catch (Exception e) { return(HttpClientHelper.LogError <SongSearchResponse>(_logger, e, new object[] { request.ArtistName, request.SongName })); } }
public async Task <IActionResult> FormattedSongSearch([FromBody] FormattedSongSearchRequest request) { try { var searchResults = await _solrService.Search(request.ArtistName, request.SongName); return(new JsonResult(new SongSearchResponse { SearchResults = searchResults })); } catch (Exception e) { _logger.LogError(e, "Error in FormattedSongSearch"); return(BadRequest()); } }