private static List <BuyHistoryRecord> ReadBuyHistoryRecors(string result) { dynamic responseServerD = JsonConvert.DeserializeObject(result); dynamic itemsD = responseServerD.data.items; List <BuyHistoryRecord> historyBuyRecords = new List <BuyHistoryRecord>(); if (itemsD != null) { foreach (dynamic item in itemsD) { BuyHistoryRecord historyBuyRecord = ReadBuyHistoryRecord(item); historyBuyRecords.Add(historyBuyRecord); } } return(historyBuyRecords); }
private static BuyHistoryRecord ReadBuyHistoryRecord(dynamic item) { AppId.AppName?appId = null; if (item.app_id != null) { appId = (AppId.AppName)(int) item.app_id; } string itemId = item.item_id ?? null; string marketHashName = item.market_hash_name ?? null; double? buyPrice = item.buy_price ?? null; bool? withdrawn = item.withdrawn ?? null; DateTime?time = null; if (item.time != null) { time = DateTimeExtension.FromUnixTime((long)item.time); } BuyHistoryRecord historyBuyRecord = new BuyHistoryRecord(appId, itemId, marketHashName, buyPrice, withdrawn, time); return(historyBuyRecord); }