Пример #1
0
        public static string CheckOfficialAnswer(string contentId, string commentId, string commentType)
        {
            try
            {
                ContentCommentRepository.UpdateOfficialAnswers(CurrentUser.Instance.SiteID, Guid.Parse(contentId), commentType.ToEnum <CommentTables>());
                var guidCommentId = Guid.Parse(commentId);
                var toUpdatePublicationComment = ContentCommentRepository.SelectById(CurrentUser.Instance.SiteID, guidCommentId, commentType.ToEnum <CommentTables>());
                if (toUpdatePublicationComment != null)
                {
                    toUpdatePublicationComment.IsOfficialAnswer = true;
                    ContentCommentRepository.Update(CurrentUser.Instance.SiteID, toUpdatePublicationComment, commentType.ToEnum <CommentTables>());
                }

                return(string.Empty);
            }
            catch (Exception ex)
            {
                Log.Error(string.Format("ContentComment CheckOfficialAnswer({0}, {1}, {2})", contentId, commentId, commentType), ex);
                return("error");
            }
        }
Пример #2
0
        public static string UpdateCommentText(string commentId, string commentText, string commentType)
        {
            try
            {
                var comment = ContentCommentRepository.SelectById(CurrentUser.Instance.SiteID, Guid.Parse(commentId), commentType.ToEnum <CommentTables>());

                if (comment != null && comment.SiteID == CurrentUser.Instance.SiteID)
                {
                    commentText = Sanitizer.GetSafeHtmlFragment(commentText);

                    comment.Comment = commentText;
                    ContentCommentRepository.Update(CurrentUser.Instance.SiteID, comment, commentType.ToEnum <CommentTables>());
                    return(comment.Comment.ToHtml());
                }

                return(string.Empty);
            }
            catch (Exception ex)
            {
                Log.Error(string.Format("ContentComment UpdateCommentText({0}, {1}, {2})", commentId, commentText, commentType), ex);
                return(null);
            }
        }