public SolarModel(JSONSolarModel model) { rName.Value = model.Name; rRadius.Value = model.Radius; rCreatedSC.Value = model.CreatedSC; rLifetime.Value = model.Lifetime; for (int i = 0; i < model.Planets.Count; i++) { Planets.Add(new PlanetModel(model.Planets[i])); } }
public JSONSolarModel toJSON() { JSONSolarModel model = new JSONSolarModel(); model.Name = rName.Value; model.Radius = rRadius.Value; model.Lifetime = rLifetime.Value; model.CreatedSC = rCreatedSC.Value; model.Planets = new List <JSONPlanetModel>(); for (int i = 0; i < Planets.Count; i++) { model.Planets.Add(Planets[i].toJSON()); } return(model); }