예제 #1
0
        public ActionResult CommentSection(long?id, string sortOrder)
        {
            VideoPageDetailsForCommentSection((long)id);

            ViewBag.SortOrder = String.IsNullOrEmpty(sortOrder) ? "latest" : "";
            ViewBag.Values    = Comment.CommentsSortOrderSelectList();
            if (id == null)
            {
                return(PartialView());
            }
            var comments = _commentsRepository.GetAllCommentsForVideo((long)id);

            comments = SortComments(comments, sortOrder);
            var commentsDTO = CommentDTO.ConvertCollectionCommentToDTO(comments);

            return(PartialView(commentsDTO));
        }
예제 #2
0
        public ActionResult CreateComment(Comment comment)
        {
            if (UsersHelper.LoggedInUserUsername(Session) == null)
            {
                return(null);
            }
            var currentUser = UsersHelper.LoggedInUserUsername(Session);

            if (currentUser == null)
            {
                return(null);
            }
            comment.CommentOwner = currentUser;
            comment.DatePosted   = DateTime.Now;
            _commentsRepository.CreateComment(comment);

            ViewBag.Values = Comment.CommentsSortOrderSelectList();
            var cdto = CommentDTO.ConvertCommentToDTO(comment);

            return(PartialView("SingleComment", cdto));
        }