Пример #1
0
        private static BoughtItem ReadBoughtItem(dynamic item)
        {
            string   itemId         = item.item_id ?? null;
            string   marketHashName = item.market_hash_name ?? null;
            double?  price          = item.price ?? null;
            DateTime?withdrawableAt = null;

            if (item.withdrawable_at != null)
            {
                withdrawableAt = DateTimeExtension.FromUnixTime((long)item.withdrawable_at);
            }

            BoughtItem boughtItem = new BoughtItem(itemId, marketHashName, price, withdrawableAt);

            return(boughtItem);
        }
Пример #2
0
        private static List <BoughtItem> ReadBoughtItems(string result)
        {
            dynamic responseServerD = JsonConvert.DeserializeObject(result);
            dynamic itemsD          = responseServerD.data.items;

            List <BoughtItem> boughtItems = new List <BoughtItem>();

            if (itemsD != null)
            {
                foreach (dynamic item in itemsD)
                {
                    BoughtItem boughtItem = ReadBoughtItem(item);
                    boughtItems.Add(boughtItem);
                }
            }

            return(boughtItems);
        }