public void PropStrToObj() { if (slots == null) { slots = ""; } try { SlotsObj = JsonConvert.DeserializeObject <SpecSlotsModel>(slots); } catch { } if (SlotsObj == null) { SlotsObj = new SpecSlotsModel(); } SlotsObj.InitFaces(); if (components == null) { components = ""; } try { ComponentsObj = JsonConvert.DeserializeObject <List <FProductComponentModel> >(components); } catch { } if (ComponentsObj == null) { ComponentsObj = new List <FProductComponentModel>(); } }
public void PropObjToStr() { if (SlotsObj == null) { slots = ""; } else { SlotsObj.SortSlots(); SlotsObj.FaceSlotsTo3dSlots(); slots = JsonConvert.SerializeObject(SlotsObj); } //do not change components. if (ComponentsObj == null) { components = ""; } else { components = JsonConvert.SerializeObject(ComponentsObj); } }