public List <Book> Search(string author, string title) { var query = string.Empty; if (!string.IsNullOrWhiteSpace(author) && !string.IsNullOrWhiteSpace(title)) { query = $"inauthor:{author}+intitle:{title}"; } else if (!string.IsNullOrWhiteSpace(author) && string.IsNullOrWhiteSpace(title)) { query = $"inauthor:{author}"; } else if (string.IsNullOrWhiteSpace(author) && !string.IsNullOrWhiteSpace(title)) { query = $"intitle:{title}"; } var result = _service.List(query); var volumes = result.Execute().Items; var books = new List <Book>(); if (volumes != null && volumes.Any()) { books.AddRange(volumes.Select(x => ConvertVolumeToBook(x, true))); } return(books); }
public IListRequest List(string query) { var request = _volumesResource.List(query); var stub = new ListRequestStub(request); return(stub); }
private void BtnSearch_Click(object sender, RoutedEventArgs e) { VolumesResource volumesResource = new VolumesResource(_booksService); var volumeList = volumesResource.List(TxtInput.Text).Execute(); string volumeResults = ""; foreach (var item in volumeList.Items) { volumeResults += $"{item.VolumeInfo.Title}{Environment.NewLine}"; } TxtblkDisplay.Text = volumeResults; }