Exemplo n.º 1
0
 /// <summary>
 /// Create from service model
 /// </summary>
 /// <param name="model"></param>
 public HistoryReadResponseApiModel(HistoryReadResultModel <JToken> model)
 {
     if (model == null)
     {
         throw new ArgumentNullException(nameof(model));
     }
     History           = model.History;
     ContinuationToken = model.ContinuationToken;
     ErrorInfo         = model.ErrorInfo == null ? null :
                         new ServiceResultApiModel(model.ErrorInfo);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create from service model
 /// </summary>
 /// <typeparam name="S"></typeparam>
 /// <typeparam name="T"></typeparam>
 /// <param name="model"></param>
 /// <param name="convert"></param>
 public static HistoryReadResponseApiModel <T> ToApiModel <S, T>(
     this HistoryReadResultModel <S> model, Func <S, T> convert)
 {
     if (model == null)
     {
         return(null);
     }
     return(new HistoryReadResponseApiModel <T> {
         History = convert(model.History),
         ContinuationToken = model.ContinuationToken,
         ErrorInfo = model.ErrorInfo.ToApiModel()
     });
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create from service model
 /// </summary>
 /// <param name="model"></param>
 public static HistoryReadResponseApiModel <VariantValue> ToApiModel(
     this HistoryReadResultModel <VariantValue> model)
 {
     if (model == null)
     {
         return(null);
     }
     return(new HistoryReadResponseApiModel <VariantValue> {
         History = model.History,
         ContinuationToken = model.ContinuationToken,
         ErrorInfo = model.ErrorInfo.ToApiModel()
     });
 }
 /// <summary>
 /// Create from service model
 /// </summary>
 /// <typeparam name="S"></typeparam>
 /// <param name="model"></param>
 /// <param name="convert"></param>
 public static HistoryReadResponseApiModel <T> Create <S>(
     HistoryReadResultModel <S> model, Func <S, T> convert)
 {
     if (model == null)
     {
         throw new ArgumentNullException(nameof(model));
     }
     return(new HistoryReadResponseApiModel <T> {
         History = convert(model.History),
         ContinuationToken = model.ContinuationToken,
         ErrorInfo = model.ErrorInfo == null ? null :
                     new ServiceResultApiModel(model.ErrorInfo)
     });
 }