コード例 #1
0
 private static RetrievedBookInfoDto MapGoogleApiBookToDto(ExternalBookInfo bookInfo)
 {
     return(new RetrievedBookInfoDto
     {
         Author = bookInfo.Author,
         Title = bookInfo.Title,
         Url = bookInfo.Url
     });
 }
コード例 #2
0
ファイル: BookService.cs プロジェクト: VismaLietuva/simoona
        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);
        }
コード例 #3
0
        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);
        }