예제 #1
0
        public ActionResult<IEquatable<BookDto>> GetBooksByAuthor(Guid authorId, Guid bookId)
        {
            if (!_restApiRepository.AuthorExists(authorId))
            {
                return NotFound();
            }
            var booksForAuhthorFromRepo = _restApiRepository.GetBook(authorId, bookId);

            if (booksForAuhthorFromRepo == null)
            {
                return NotFound();
            }
            return Ok(_mapper.Map<BookDto>(booksForAuhthorFromRepo));
        }
예제 #2
0
        public Book GetBook(Guid authorId, Guid bookId)
        {
            if (authorId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(authorId));
            }

            if (bookId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(bookId));
            }

            return(_restApiRepository.GetBook(authorId, bookId));
        }