Пример #1
0
        public static int CreateComment(int hostID, int storyID, User user, string comment)
        {
            if (user.IsBanned)
                throw new SecurityException("A banned user can not post a comment");

            if (comment.Length > 4000)
                comment = comment.Substring(0, 4000);

            Comment newComment = new Comment();
            newComment.HostID = hostID;
            newComment.StoryID = storyID;
            newComment.UserID = user.UserID;
            //TODO: GJ: rename comment as it is the same as the table name
            newComment.CommentX = comment;
            newComment.Save();

            StoryBR.IncrementStoryCommentCount(storyID);
            UserAction.RecordComment(hostID, user, Story.FetchByID(storyID), newComment.CommentID);
            return newComment.CommentID;
        }
Пример #2
0
        public void Insert(int StoryID,int UserID,string CommentX,DateTime CreatedOn,int HostID,bool IsSpam)
        {
            Comment item = new Comment();

            item.StoryID = StoryID;

            item.UserID = UserID;

            item.CommentX = CommentX;

            item.CreatedOn = CreatedOn;

            item.HostID = HostID;

            item.IsSpam = IsSpam;

            item.Save(UserName);
        }