Beispiel #1
0
        public List <ComicBook> GetFilteredComics(string filteredString)
        {
            var client = new MarvelRestClient(publicKey, privateKey);
            var filter = new ComicRequestFilter();

            filter.TitleStartsWith = filteredString;
            var response = client.FindComics(filter);
            List <ComicBook> comicList = new List <ComicBook>();

            if (response != null && response.Data != null)
            {
                foreach (var comic in response.Data.Results)
                {
                    var book = new ComicBook();
                    book.SeriesTitle = comic.Title;
                    book.Description = SetDescription(comic);//comic.Description;
                    book.IssueNumber = comic.IssueNumber;
                    var thumbNail = new Thumbnail();
                    thumbNail.Path      = comic.Thumbnail.Path;
                    thumbNail.Extension = comic.Thumbnail.Extension;
                    book.Thumbnail      = thumbNail;
                    List <ComicImage> images = new List <ComicImage>();
                    for (int i = 0; i < comic.Images.Count; i++)
                    {
                        ComicImage image = new ComicImage();
                        image.Extension = comic.Images[i].Extension;
                        image.Path      = comic.Images[i].Path;
                        images.Add(image);
                    }
                    comicList.Add(book);
                }
            }
            return(comicList);
        }
Beispiel #2
0
        /// <summary>
        /// Limited to the 1 comic ordered by Name Ascending
        /// </summary>
        /// <param name="title"></param>
        /// <returns></returns>
        public static Comic GetComic(string title)
        {
            var creds  = new Credentials();
            var client = new MarvelRestClient(creds.PublicKey, creds.PrivateKey);

            var filter = new ComicRequestFilter();

            filter.OrderBy(OrderResult.NameAscending);
            filter.Limit           = 1;
            filter.TitleStartsWith = title;

            var comicResponse = client.FindComics(filter);

            return(ResultsToList(comicResponse)[0]);
        }