private static RetrievedBookInfoDto MapGoogleApiBookToDto(ExternalBookInfo bookInfo) { return(new RetrievedBookInfoDto { Author = bookInfo.Author, Title = bookInfo.Title, Url = bookInfo.Url }); }
private static RetrievedBookInfoDto MapBookInfoToDto(ExternalBookInfo book) { var retrievedBookDto = new RetrievedBookInfoDto { Author = book.Author, Url = book.Url, Title = book.Title, OwnerId = book.OwnerId, Note = book.Note }; return(retrievedBookDto); }
public async Task <ExternalBookInfo> FindBookByIsbnAsync(string isbn) { var query = $"isbn:{isbn}"; var result = await _service.Volumes.List(query).ExecuteAsync(); if (result.Items == null) { return(null); } var volume = result.Items.First().VolumeInfo; var bookInfo = new ExternalBookInfo { Author = volume.Authors == null ? "Authors not set" : string.Join(", ", volume.Authors), Title = volume.Title, Url = volume.InfoLink, CoverImageUrl = volume.ImageLinks?.Thumbnail }; return(bookInfo); }