public IActionResult Get([FromQuery] GetAuthorSearchHttpRequest request) { var serviceResponse = _authorService.GetAuthor(request.SearchText, SearchType.TEXT); var httpResponse = new GetAuthorsHttpResponse { Authors = new List <AuthorModel> { serviceResponse.Author } }; return(StatusCode((int)HttpStatusCode.OK, httpResponse)); }
public IActionResult Get([FromQuery] GetAuthorSearchHttpRequest request) { var dispatcherResponse = _authorDispatchService.RouteToAuthorGet(new GetAuthorSearchDispatcherRequest() { SearchKey = request.SearchKey }); var response = new GetAuthorHttpResponse { Total = dispatcherResponse.Total, Authors = dispatcherResponse.Authors.Select( t => new AuthorHttpModel { Id = t.Id, Name = t.Name, Bio = t.Data.Bio, Birthday = t.Data.Birthday , Dead = t.Data.Dead, Location = t.Data.Location, ImageUrl = t.Data.ImageUrl , Books = t.Data.Books }) }; return(StatusCode((int)HttpStatusCode.OK, response)); }