コード例 #1
0
        public async Task <IActionResult> RefreshApprenticeships(Guid documentId)
        {
            logService.LogInformation($"{nameof(RefreshApprenticeships)} has been called with document Id {documentId}");

            var feedRefreshResponseViewModel = new FeedRefreshResponseViewModel();

            try
            {
                //catch any exception that the outgoing request may throw.
                feedRefreshResponseViewModel.NumberPulled = await aVCurrentOpportunatiesRefresh.RefreshApprenticeshipVacanciesAndUpdateJobProfileAsync(documentId).ConfigureAwait(false);

                return(Ok(feedRefreshResponseViewModel));
            }
            catch (HttpRequestException httpRequestException)
            {
                feedRefreshResponseViewModel.RequestErrorMessage = httpRequestException.Message;
                return(BadRequest(feedRefreshResponseViewModel));
            }
        }
コード例 #2
0
        public async Task <IActionResult> RefreshCourses(Guid documentId)
        {
            logService.LogInformation($"{nameof(RefreshCourses)} has been called with document Id {documentId}");
            var feedRefreshResponseViewModel = new FeedRefreshResponseViewModel();

            try
            {
                //catch any exception that the outgoing request may throw.
                feedRefreshResponseViewModel.NumberPulled = await courseCurrentOpportunitiesRefresh.RefreshCoursesAndUpdateJobProfileAsync(documentId).ConfigureAwait(false);

                logService.LogInformation($"Get courses has succeeded for: document {documentId} - Got {feedRefreshResponseViewModel.NumberPulled} courses");
                return(Ok(feedRefreshResponseViewModel));
            }
            catch (HttpRequestException httpRequestException)
            {
                feedRefreshResponseViewModel.RequestErrorMessage = httpRequestException.ToString();
                logService.LogError($"{nameof(RefreshCourses)} had exception when getting courses for document {documentId}, Exception - {feedRefreshResponseViewModel.RequestErrorMessage}");
                return(BadRequest(feedRefreshResponseViewModel));
            }
        }