/// <summary> /// Create from service model /// </summary> /// <param name="model"></param> public HistoricValueApiModel(HistoricValueModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } Value = model.Value; StatusCode = model.StatusCode; SourceTimestamp = model.SourceTimestamp; SourcePicoseconds = model.SourcePicoseconds; ServerTimestamp = model.ServerTimestamp; ServerPicoseconds = model.ServerPicoseconds; ModificationInfo = model.ModificationInfo == null ? null : new ModificationInfoApiModel(model.ModificationInfo); }
/// <summary> /// Create from service model /// </summary> /// <param name="model"></param> public static HistoricValueApiModel ToApiModel( this HistoricValueModel model) { if (model == null) { return(null); } return(new HistoricValueApiModel { Value = model.Value, StatusCode = model.StatusCode, SourceTimestamp = model.SourceTimestamp, SourcePicoseconds = model.SourcePicoseconds, ServerTimestamp = model.ServerTimestamp, ServerPicoseconds = model.ServerPicoseconds, ModificationInfo = model.ModificationInfo.ToApiModel() }); }