Exemple #1
0
 private BookViewModel ToBookViewModel(AmazItem t)
 {
     return new BookViewModel
     {
         ASIN = t.ASIN,
         Title = t.Title,
         Author = t.Author,
         Page = t.Page,
         LargeImageURL = t.LargeImageURL,
         DetailPageURL = t.DetailPageURL,
         Price = t.Price,
         PubDate = t.PubDate,
         Publisher = t.Publisher
     };
 }
Exemple #2
0
        private AmazItem ItemToAmaz(JToken item)
        {
            var attr = item["ItemAttributes"][0];
            var amazItem = new AmazItem
            {
                ASIN = (string)GetItemZero(item, "ASIN"),
                DetailPageURL = (string)GetItemZero(item, "DetailPageURL"),
                LargeImageURL = (string)GetItemZero(item, "LargeImage", "URL"),

                Author = (string)GetItemZero(attr, "Author"),
                Publisher = (string)GetItemZero(attr, "Manufacturer"),
                Title = (string)GetItemZero(attr, "Title"),
                Description = ""
            };
            var price = GetItemZero(attr, "ListPrice", "Amount");
            if (price != null)
                amazItem.Price = (int)price;
            var page = GetItemZero(attr, "NumberOfPages");
            if (page != null)
                amazItem.Page = (int)page;
            var pubDate = GetItemZero(attr, "PublicationDate");
            if (pubDate != null)
                amazItem.PubDate = (DateTime)pubDate;
            return amazItem;
        }