Example #1
0
        public IActionResult GetAllBooksByTerm(string term)
        {
            try
            {
                var allBooks = _bookLibraryRepository.GetAllBooksByTerm(term);

                var allBooksResults = Mapper.Map <IEnumerable <BookWithAuthorDto> >(allBooks);

                return(Ok(allBooksResults));
            }
            catch (Exception ex)
            {
                _logger.LogInformation($"Exeption while getting all books by search term", ex);
                return(StatusCode(500, "A problem happend while handeling your request."));
            }
        }