public ReplyCommentViewModel(Comment parentComment) { if (parentComment != null) { ContentTitle = parentComment.Content.Title; AuthorId = parentComment.Content.AuthorId; GroupId = parentComment.Content.GroupId; AddComment = new _AddCommentViewModel { ParentCommentId = parentComment.Id, ReturnUrl = parentComment.Content.GetUrl() }; Comment = new _Comments_CommentViewModel(parentComment); } }
public ReplyCommentViewModel(Comment parentComment) { if (parentComment != null) { ContentTitle = parentComment.Content.Title; AuthorId = parentComment.Content.AuthorId; GroupId = parentComment.Content.GroupId; AddComment = new _AddCommentViewModel { ParentCommentId = parentComment.Id, ReturnUrl = parentComment.Content.GetUrl() }; Comment = new _Comments_CommentViewModel(parentComment); } }
public ActionResult Add(_AddCommentViewModel model) { if (!Request.IsAuthenticated) throw new AuthenticationException(); var comment = CommentService.AddComment(model.Text, UserContext.Current.Id, model.ContentId, model.ParentCommentId); var returnUrl = new StringBuilder(); if (!string.IsNullOrWhiteSpace(model.ReturnUrl)) returnUrl.Append(model.ReturnUrl); else returnUrl.Append(Request.UrlReferrer.PathAndQuery); returnUrl.Append("#" + comment.Id); return Redirect(returnUrl.ToString()); }
public ReplyCommentViewModel() { AddComment = new _AddCommentViewModel(); Comment = new _Comments_CommentViewModel(); }
public ReplyCommentViewModel() { AddComment = new _AddCommentViewModel(); Comment = new _Comments_CommentViewModel(); }