예제 #1
0
        public IActionResult Index(int id)
        {
            _questionImplementation.AddView(id).Wait();
            var question = _questionImplementation.GetById(id);
            var answers  = Buildanswers(question.Answers);

            var model = new QuestionIndexModel
            {
                QuestionId      = question.QuestionId,
                QuestionTitle   = question.QuestionTitle,
                AuthorId        = question.User.Id,
                AuthorName      = question.User.UserName,
                AuthorImageUrl  = question.User.ProfileImageUrl,
                AuthorRating    = question.User.Rating,
                QuestionCreated = question.QuestionCreated,
                QuestionContent = question.QuestionContent,
                Answers         = answers,
                AnswerCount     = question.Answers.Count(),
                CategoryId      = question.Category.CategoryId,
                CategoryTitle   = question.Category.CategoryTitle,
                IsAuthorAdmin   = IsAuthorAdmin(question.User),
                LikeCount       = question.LikeQuestions.Count(),
                NumberView      = question.NumberViews
            };

            return(View(model));
        }
예제 #2
0
 // GET: Question/Details/5
 public ActionResult Details(int id)
 {
     return(View(_questionRepo.GetById(id)));
 }