Exemple #1
0
        public ActionResult Comentario(int commentId, string view)
        {
            int?currentUserId = null;

            if (User.Identity.IsAuthenticated)
            {
                currentUserId = ((CustomPrincipal)User).UserId;
            }

            ViewBag.CurrentUserId = currentUserId;

            CommentRepository comment = new CommentRepository(SessionCustom);

            comment.Entity.CommentId = commentId;
            comment.LoadByKey();
            int total = 0;
            List <CommentsPaging> result = comment.CommentsPagingById(commentId, comment.Entity.IdeaId, comment.Entity.ContentId, out total);

            if (result.Count > 0)
            {
                result[0].CommentCount = total;
            }

            if (string.IsNullOrEmpty(view))
            {
                if (comment.Entity.IdeaId.HasValue)
                {
                    IdeaRepository idea = new IdeaRepository(SessionCustom);
                    idea.Entity.IdeaId = comment.Entity.IdeaId;
                    idea.LoadByKey();
                    ViewBag.Idea = idea.Entity;

                    view = "_ContentIdeaCommentsList";
                }
                else if (comment.Entity.CommentId.HasValue)
                {
                    view = "_BlogEntryCommentsList";
                }
            }

            if (string.IsNullOrEmpty(view))
            {
                return(null);
            }
            else
            {
                return(this.View(view, result));
            }
        }