/// <summary> /// Create from service model /// </summary> /// <param name="model"></param> public MethodCallResponseApiModel(MethodCallResultModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } Results = model.Results? .Select(a => a == null ? null : new MethodCallArgumentApiModel(a)) .ToList(); ErrorInfo = model.ErrorInfo == null ? null : new ServiceResultApiModel(model.ErrorInfo); }
/// <summary> /// Create from service model /// </summary> /// <param name="model"></param> public static MethodCallResponseApiModel ToApiModel( this MethodCallResultModel model) { if (model == null) { return(null); } return(new MethodCallResponseApiModel { Results = model.Results? .Select(a => a.ToApiModel()) .ToList(), ErrorInfo = model.ErrorInfo.ToApiModel() }); }