示例#1
0
        public ActionResult CommentComment(Comment comment, string Command)
        {
            try
            {
                if (Command.Equals("MarkAsRead", StringComparison.InvariantCultureIgnoreCase))
                {
                    commentManager.MarkAsRead(comment.ParentId.Value);
                }
                else
                {
                    var user = (User)Session["Login"];

                    var newComment = new Comment();
                    newComment.Text      = comment.Text;
                    newComment.ArticleId = comment.ArticleId;
                    newComment.ParentId  = comment.ParentId;

                    commentManager.AddComment(newComment);
                    userManager.UpdateUserComments(user.Id, newComment);
                    commentManager.MarkAsRead(comment.ParentId.Value);
                }

                return(RedirectToAction("UnreadComments"));
            }
            catch (Exception e)
            {
                ViewBag.ErrorTitle       = "Server Error";
                ViewBag.ErrorDescription = "Please try again later";
                return(View("~/Views/Shared/ErrorPage.cshtml"));
            }
        }