/// <summary> /// Create from service model /// </summary> /// <param name="model"></param> public SupervisorStatusApiModel(SupervisorStatusModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } DeviceId = model.DeviceId; ModuleId = model.ModuleId; SiteId = model.SiteId; Endpoints = model.Endpoints? .Select(e => e == null ? null : new EndpointActivationStatusApiModel(e)) .ToList(); }
/// <summary> /// Create api model /// </summary> /// <param name="model"></param> /// <returns></returns> public static SupervisorStatusApiModel ToApiModel( this SupervisorStatusModel model) { if (model == null) { return(null); } return(new SupervisorStatusApiModel { DeviceId = model.DeviceId, ModuleId = model.ModuleId, SiteId = model.SiteId, Endpoints = model.Endpoints? .Select(e => e.ToApiModel()) .ToList() }); }