Ejemplo n.º 1
0
        public virtual ActionResult Answer(int postId, int offset)
        {
            IEnumerable<Reply> answers = _problemQueryService.GetAllReplies(
                    postId,
                    ReplyEnum.ANSWER,
                    offset,
                    Constant.DEFAULT_PER_PAGE
                ).AsEnumerable();

            ICollection<AnswerItemVM> answerItemVms = answers
                .Select(Mapper.Map<Reply, AnswerItemVM>)
                .ToList();

            // this mapping must be have
            // if not. strange error will be appear at ViewModel in View
            foreach (AnswerItemVM am in answerItemVms) {
                am.CommentPostVm = new CommentPostVM();
                am.CommentPostVm.ReplyId = am.Id;
                am.CommentPostVm.Type = EnumCommentType.REPLY;
            }

            AnswerListVM answerListVm = new AnswerListVM();
            answerListVm.AnswerItemVms = answerItemVms;
            return PartialView("Partials/_AnswerList", answerListVm);
        }
Ejemplo n.º 2
0
        public virtual ActionResult Reply(int id, int offset)
        {
            IEnumerable<Reply> replies = _discussionQueryService.GetAllReplies(
                    id,
                    ReplyEnum.DEFAULT,
                    offset,
                    Constant.DEFAULT_PER_PAGE
                ).AsEnumerable();

            ICollection<AnswerItemVM> answerItemVms = replies.Select(Mapper.Map<Reply, AnswerItemVM>).ToList();
            AnswerListVM answerListVm = new AnswerListVM();
            answerListVm.AnswerItemVms = answerItemVms;
            return PartialView("Partials/_AnswerList", answerListVm);
        }