Exemple #1
0
        public static Catalog FromJson(JsonValue json)
        {
            if (json != null)
            {
                var catalog = new Catalog();
                catalog._RawJsonString = json.ToString();

                catalog.Id        = json.GetJsonValue(() => catalog.Id);
                catalog.PageCount = json.GetJsonValue(() => catalog.PageCount);
                catalog.Promoted  = json.GetJsonValue(() => catalog.Promoted);
                catalog.Expires   = json.GetJsonValue(() => catalog.Expires);

                catalog.PublicKey    = json.GetJsonValue(() => catalog.PublicKey);
                catalog.RunFrom      = json.GetJsonValue(() => catalog.RunFrom);
                catalog.RunTill      = json.GetJsonValue(() => catalog.RunTill);
                catalog.SelectStores = json.GetJsonValue(() => catalog.SelectStores);

                catalog.Week = Weeks.FromJson(json);

                catalog.Branding = Branding.FromJson(json);

                catalog.Dealer = Dealer.FromJson(json);
                catalog.Store  = Store.FromJson(json);

                catalog.Images = Images.FromJson(json);

                return(catalog);
            }
            return(null);
        }
 public static Weeks FromJson(JsonValue item)
 {
     if (item.ContainsKey("weeks"))
     {
         Weeks weeks = new Weeks();
         var   json  = item.GetJsonValue(() => weeks);
         weeks.From = json.GetJsonValue(() => weeks.From);
         weeks.To   = json.GetJsonValue(() => weeks.To);
         return(weeks);
     }
     return(null);
 }