/// <inheritDoc/> public CommentsCountViewModel GetCommentsCountViewModel(CommentsCountInputModel inputModel) { this.ThreadKey = inputModel.ThreadKey; this.ThreadType = inputModel.ThreadType; var allowComments = inputModel.AllowComments.HasValue ? inputModel.AllowComments.Value : this.AllowComments; if (allowComments) { if (inputModel.NavigateUrl != null && !inputModel.NavigateUrl.Contains("#")) { inputModel.NavigateUrl = inputModel.NavigateUrl + "#comments-" + HttpUtility.UrlEncode(inputModel.ThreadKey); } var viewModel = new CommentsCountViewModel() { NavigateUrl = inputModel.NavigateUrl, ThreadKey = inputModel.ThreadKey }; return(viewModel); } else { return(null); } }
/// <summary> /// Gets the view for comments count. /// </summary> /// <returns></returns> public ActionResult Count(CommentsCountInputModel commentsCountInputModel) { if (!commentsCountInputModel.AllowComments.HasValue || commentsCountInputModel.AllowComments.Value) { var commentsCountViewModel = this.Model.GetCommentsCountViewModel(commentsCountInputModel); if (commentsCountViewModel != null) { this.ViewBag.ServiceUrl = RouteHelper.ResolveUrl("~/RestApi/comments-api/", UrlResolveOptions.Rooted); return this.View(this.countTemplateName, commentsCountViewModel); } } return new EmptyResult(); }