Exemplo n.º 1
0
        public ActionResult View(int id)
        {
            var profile = _profileProvider.GetProfileByTraineeId(id);

            var profileReviewViewModel = _profileMapper.ToProfileReviewViewModel(
                profile,
                _profileProvider.GetTraineeRating(id),
                _profileProvider.IsTraineeHavingMentorReview(id),
                _profileProvider.IsTraineeHavingScrumReview(id),
                _profileProvider.IsTraineeHavingTeamReview(id));

            if (!profileReviewViewModel.HasReviews)
            {
                return(new HttpNotFoundResult());
            }

            if (profileReviewViewModel.IsTraineeHavingTeamReview)
            {
                var grades    = _traineeReviewProvider.GetTeamGradesOnTrainee(id);
                var abilities = _traineeReviewProvider.GetAbilities();

                profileReviewViewModel.RenderingReview = _traineeReviewMapper
                                                         .ToLinkedTeamReviewViewModel(abilities, grades);
            }
            else if (profileReviewViewModel.IsTraineeHavingMentorReview)
            {
                var review = _mentorReviewProvider.GetMentorReviewForTrainee(id);

                profileReviewViewModel.RenderingReview = _mentorReviewMapper
                                                         .ToLinkedMentorReviewViewModel(review);
            }
            else if (profileReviewViewModel.IsTraineeHavingScrumReview)
            {
                var review = _scrumReviewProvider.GetReviewForTrainee(id);

                profileReviewViewModel.RenderingReview = _scrumMasterMapper.ReviewToLinkedViewModel(review);
            }

            return(View(profileReviewViewModel));
        }