public List<clsTemplateAttribute> fromJSON(JArray JSONArray) { List<clsTemplateAttribute> results = new List<clsTemplateAttribute>(); // loop thorugh all the JSON obects in the JSON array foreach (JObject JSONObject in JSONArray) { clsTemplateAttribute templateAttribute = new clsTemplateAttribute(_db); // create new blank template templateAttribute.fromJSON(JSONObject); // load template based on JSON Object results.Add(templateAttribute); // add new template to results } return results; }
public new bool fromJSON(JObject JSONObj) { bool result = base.fromJSON(JSONObj); this.id = 0; // the id in JSON is from previous db. clear it. // check for templateAtributes if (JSONObj["templateAttributes"] != null) { JArray JSONArray = (JArray)JSONObj["templateAttributes"]; // convert to template attribute objects clsTemplateAttribute templateAttribute = new clsTemplateAttribute(_db); _templateAttributes = templateAttribute.fromJSON(JSONArray); foreach (clsTemplateAttribute ta in this.templateAttributes) { ta.id = 0; // the id in JSON is from previous db. clear it. ta.templateId = 0; // we will not know our template id until was save our template } } return result; }