/// <summary>Map an API model to the corresponding service model</summary> /// <param name="id">The simulation ID when using PUT/PATCH, empty otherwise</param> public Simulation ToServiceModel(string id = "") { this.Id = id; var result = new Simulation { Etag = this.Etag, Id = this.Id, // When unspecified, a simulation is enabled Enabled = this.Enabled ?? true }; foreach (var x in this.DeviceModels) { var dt = new Simulation.DeviceModelRef { Id = x.Id, Count = x.Count }; result.DeviceModels.Add(dt); } return(result); }
// Map service model to API model public static SimulationDeviceModelRef FromServiceModel(Simulation.DeviceModelRef value) { if (value == null) { return(null); } return(new SimulationDeviceModelRef { Id = value.Id, Count = value.Count, Override = DeviceModelApiModelOverride.FromServiceModel(value.Override) }); }