示例#1
0
        public async Task <IActionResult> SearchBooksAsync(string searchTerm, int page = 1)
        {
            if (string.IsNullOrWhiteSpace(searchTerm))
            {
                return(BadRequest("Search term is empty."));
            }

            try
            {
                return(Ok(await _bookProvider.SearchBooksAsync(searchTerm, page)));
            }
            catch (Exception e)
            {
                // TODO: Handle exception
                return(BadRequest(e));
            }
        }