Exemple #1
0
        public virtual ActionResult Comment(int postId, int offset)
        {
            offset = offset < 0 ? Constant.DEFAULT_COMMENT_OFFSET : offset;
            int limit = offset < 0 ? int.MaxValue : Constant.DEFAULT_COMMENT_LOADING;

            IEnumerable<Comment> comments = _discussionQueryService.GetAllReplyComments(
                postId,
                offset,
                limit
                );

            // Map list models to list viewmodels with lambda expression
            ICollection<CommentItemVM> hintItemVms = comments.Select(Mapper.Map<Comment, CommentItemVM>).ToList();

            CommentListVM commentListVm = new CommentListVM();

            commentListVm.CommentItemVms = hintItemVms;
            return PartialView("Partials/_CommentList", commentListVm);
        }
Exemple #2
0
        public virtual ActionResult GetReplyComments(int postId, int offset)
        {
            int limit = offset < 0 ? int.MaxValue : Constant.DEFAULT_COMMENT_LOADING;
            offset = offset < 0 ? Constant.DEFAULT_COMMENT_OFFSET : offset;


            IEnumerable<Comment> comments = _problemQueryService.GetAllReplyComments(
                postId,
                offset,
                limit
                );

            // Map list models to list viewmodels with lambda expression 
            ICollection<CommentItemVM> commentItemVms = comments
                .Select(Mapper.Map<Comment, CommentItemVM>)
                //  .ForEach( c => c.Type = Models.CommonVM.EnumCommentType.REPLY);
                .ToList();

            foreach (CommentItemVM cm in commentItemVms)
            {
                cm.Type = Models.CommonVM.EnumCommentType.REPLY;
            }

            CommentListVM commentListVm = new CommentListVM();

            commentListVm.CommentItemVms = commentItemVms;
            return PartialView("Partials/_CommentList", commentListVm);
        }