コード例 #1
0
        public async Task <List <ReportSourceColumnDto> > GetReportSourceColumns(ReportSourceDto dto)
        {
            try
            {
                var content  = _serviceResponseHandler.BuildJsonContent(dto);
                var response = await _httpClient.PostAsync("api/Adhoc/ReportSources/Columns", content);

                return(await _serviceResponseHandler.HandleJsonResponse <List <ReportSourceColumnDto> >(response));
            }
            catch (AccessTokenNotAvailableException exception)
            {
                exception.Redirect();
            }

            return(new List <ReportSourceColumnDto>());
        }
コード例 #2
0
        public async Task <RocketDto?> SaveRocket(RocketDto dto)
        {
            try
            {
                Task <HttpResponseMessage>?saveTask;
                var content = _serviceResponseHandler.BuildJsonContent(dto);
                if (dto.RocketId == 0)
                {
                    saveTask = _httpClient.PostAsync("api/Rockets", content);
                }
                else
                {
                    saveTask = _httpClient.PutAsync("api/Rockets", content);
                }

                var response = await saveTask;
                return(await _serviceResponseHandler.HandleJsonResponse <RocketDto>(response));
            }
            catch (AccessTokenNotAvailableException exception)
            {
                exception.Redirect();
            }
            return(null);
        }