Esempio n. 1
0
        public async Task <IActionResult> AddResourceToActionPlan(
            int selfAssessmentId,
            int resourceReferenceId,
            ReturnPageQuery returnPageQuery
            )
        {
            var delegateId = User.GetCandidateIdKnownNotNull();

            if (!actionPlanService.ResourceCanBeAddedToActionPlan(resourceReferenceId, delegateId))
            {
                return(NotFound());
            }

            try
            {
                await actionPlanService.AddResourceToActionPlan(resourceReferenceId, delegateId, selfAssessmentId);
            }
            catch (ResourceNotFoundException e)
            {
                if (!e.ApiIsAccessible)
                {
                    return(NotFound());
                }

                var assessment = selfAssessmentService.GetSelfAssessmentForCandidateById(delegateId, selfAssessmentId);
                var model      = new ResourceRemovedViewModel(assessment !);
                return(View("ResourceRemovedErrorPage", model));
            }

            var routeData = returnPageQuery.ToRouteDataDictionary();

            routeData.Add("selfAssessmentId", selfAssessmentId.ToString());
            return(RedirectToAction("RecommendedLearning", "RecommendedLearning", routeData, returnPageQuery.ItemIdToReturnTo));
        }
Esempio n. 2
0
        private async Task <IActionResult> ReturnFilteredResultsView(int selfAssessmentId, int candidateId)
        {
            var filteredToken = await GetFilteredToken();

            var assessment = selfAssessmentService.GetSelfAssessmentForCandidateById(candidateId, selfAssessmentId) !;
            var model      = new SelfAssessmentFilteredResultsViewModel
            {
                SelfAssessment      = assessment,
                CompetencyPlayLists = await filteredApiHelperService.GetPlayListsPoll <IEnumerable <PlayList> >(
                    filteredToken,
                    "playlist.FetchCompetencyPlaylists"
                    ),
                RecommendedPlayLists = await filteredApiHelperService.GetPlayListsPoll <IEnumerable <PlayList> >(
                    filteredToken,
                    "playlist.FetchNexRexPlaylists"
                    ),
                FavouritePlayList = await filteredApiHelperService.GetPlayList <PlayList>(
                    filteredToken,
                    "playlist.FetchFavouritePlaylist",
                    null
                    ),
            };

            return(View("../LearningPortal/SelfAssessments/FilteredMgp/FilteredResults", model));
        }