public static Offer FromJson(JsonValue item) { if (item != null && item.ContainsKey("id")) { Offer offer = new Offer(); var json = item; offer.Id = json.GetJsonValue(() => offer.Id); offer.SelectStores = json.GetJsonValue(() => offer.SelectStores); offer.Promoted = json.GetJsonValue(() => offer.Promoted); offer.Heading = json.GetJsonValue(() => offer.Heading); offer.Description = json.GetJsonValue(() => offer.Description); offer.Price = json.GetJsonValue(() => offer.Price); offer.Preprice = json.GetJsonValue(() => offer.Preprice); offer.Images = Images.FromJson(json); offer.Url = json.GetJsonValue(() => offer.Url); offer.RunFrom = json.GetJsonValue(() => offer.RunFrom); offer.RunTill = json.GetJsonValue(() => offer.RunTill); offer.Dealer = Dealer.FromJson(json); //offer.Timespan = Timespan.FromJson(json.GetJsonValue(() => offer.Timespan)); offer.Catalog = CatalogIndex.FromJson(json); offer.Store = Store.FromJson(json); return(offer); } return(null); }
public static CatalogIndex FromJson(JsonValue item) { if (item.ContainsKey("catalog")) { CatalogIndex catalogIndex = new CatalogIndex(); var json = item["catalog"]; catalogIndex.Id = json.GetJsonValue(() => catalogIndex.Id); //catalogIndex.PublicKey = json.GetJsonValue(() => catalogIndex.PublicKey); catalogIndex.Page = json.GetJsonValue(() => catalogIndex.Page); return(catalogIndex); } return(null); }