public async Task <JsonResult> SearchBooksAsync(string searchQuery, [FromServices] IBooksClient booksClient) { var results = await booksClient.SearchBooksAsync(searchQuery); List <BookSearchResultViewModel> models = new List <BookSearchResultViewModel>(); foreach (var result in results) { BookSearchResultViewModel model = new BookSearchResultViewModel(); model.Title = result.Title; model.Description = result.Description; model.CoverImageUrl = result.CoverImageUrl; model.Rating = result.Rating == null ? null : result.Rating.ToString(); model.RatingCount = result.RatingCount.ToString(); model.PublishedDate = result.PublishedDate == null ? null : result.PublishedDate.ToString(); model.PageCount = result.PageCount == null ? null : result.PageCount.ToString(); model.Isbn = result.Isbn; if (result.Authors != null) { model.Authors = string.Join(", ", result.Authors); } if (result.Genres != null) { model.Genres = string.Join(", ", result.Genres); } if (result.PublishedDate != null) { model.Year = result.PublishedDate.Value.Year.ToString(); } models.Add(model); } return(Json(models)); }
public GenreController(IGenresClient genresClient, IBooksClient booksClient) { this.booksClient = booksClient; this.genresClient = genresClient; }
public BooksController(IBooksClient booksClient, IMapper mapper) { _booksClient = booksClient; _mapper = mapper; }
public HomeController(IBooksClient booksClient) { this.booksClient = booksClient; }
public BooksClientsTests() { BooksClient = Helper.GetClient().Books; }
public ValuesController(IBooksClient booksClient) { _booksClient = booksClient; }
public CartController(ICartItemClient cartItemClient, ICartsClient cartsClient, IBooksClient booksClient) { this.cartsClient = cartsClient; this.booksClient = booksClient; this.cartItemClient = cartItemClient; }
public BookPageController(IBooksClient booksClient) { this.booksClient = booksClient; }