public Inventory(string json) { var j = new JSON(json); foreach (var entry in (List<object>)j.fields["purchaseMap"]) { List<object> pair = (List<object>) entry; string key = pair[0].ToString(); Purchase value = new Purchase(pair[1].ToString()); _purchaseMap.Add(key, value); } foreach (var entry in (List<object>) j.fields["skuMap"]) { List<object> pair = (List<object>) entry; string key = pair[0].ToString(); SkuDetails value = new SkuDetails(pair[1].ToString()); _skuMap.Add(key, value); } }
public Inventory(string json) { var j = new JSON(json); foreach (var entry in (List <object>)j.fields["purchaseMap"]) { List <object> pair = (List <object>)entry; string key = pair[0].ToString(); Purchase value = new Purchase(pair[1].ToString()); _purchaseMap.Add(key, value); } foreach (var entry in (List <object>)j.fields["skuMap"]) { List <object> pair = (List <object>)entry; string key = pair[0].ToString(); SkuDetails value = new SkuDetails(pair[1].ToString()); _skuMap.Add(key, value); } }
public void AddSkuDetails(SkuDetails d) { _skuMap.Add(d.Sku, d); }