예제 #1
0
        public UpdateColumnMappingResponse UpdateColumnMapping(string platform, int columnId, int?userId, ReportColumnMapping columnMapping)
        {
            var result = new UpdateColumnMappingResponse();

            try
            {
                using (new RequestTimer(result))
                {
                    var dataSource = _reportsDataSourceFactory.GetDataSource(platform);
                    var column     = dataSource.GetColumnProvider().UpdateColumnMapping(dataSource.DataSourceId, columnId, columnMapping, dataSource.GetColumnValidator());
                    result.Data = column;
                }
            }
            catch (Exception ex)
            {
                result.Error = new ResponseError().Load(ex);
                _logger.LogException(ex);
            }
            return(result);
        }
예제 #2
0
        public UpdateColumnMappingResponse UpdateColumnMapping(string platform, int columnId, int?userId, ReportColumnMapping columnMapping)
        {
            var result = new UpdateColumnMappingResponse();

            try
            {
                // PUT
                var apiRequest = CreateRequest(Method.PUT, "{platform}/columnMappings/{columnId}");
                apiRequest.AddUrlSegment("platform", platform);
                apiRequest.AddUrlSegment("columnId", columnId.ToString());
                if (userId != null)
                {
                    apiRequest.AddParameter("userid", userId, ParameterType.QueryString);
                }
                apiRequest.AddBody(columnMapping);
                var response = Execute <UpdateColumnMappingResponse>(apiRequest);
                return(response);
            }
            catch (Exception ex)
            {
                result.Error = new ResponseError().Load(ex);
            }
            return(result);
        }