private BookDto GetBookDto(Book book)
        {
            var dto = new BookDto
            {
                Id          = book.Id,
                Isbn        = book.Isbn,
                Title       = book.Title,
                ReleaseDate = book.ReleaseDate,
                Price       = _priceEngine.GetPriceForBook(book.Id)?.Amount ?? 0m,
                Rating      = _ratingEngine.GetRatingForBook(book.Id),
            };

            return(dto);
        }
Example #2
0
 public IActionResult GetPriceForBook(int bookId)
 {
     return(Ok(_priceEngine.GetPriceForBook(bookId)));
 }