Example #1
0
        public async Task <IActionResult> ShowAnswer(string data = null)
        {
            // Data can't be null because at least answer id is there.
            var navigationData = NavigationHelper.Decode(data);

            if (navigationData == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var culture = this.Culture;
            // Load the answer.
            var answer = await _answerService.FindByAnswerId(navigationData.AnswerId);

            // Go home is not found
            if (answer == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var answerDetailsDto = HomeController.FillInDetails(answer, _answerDescriptionService, _userService, _voteService,
                                                                _resourcesService, culture, _appSettings.Value.FullDomainAddress);

            // Set the reason to be shown on the page in case someone sent it
            answerDetailsDto.Reason = navigationData.Reason;

            // Set the user leveling data in case we need to show level or achievement.
            answerDetailsDto.UserLevelingResult = navigationData.UserLevelingResult;

            return(View("MyContent", answerDetailsDto));
        }