Ejemplo n.º 1
0
        public string newPost(object blogid, string username, string password, Westwind.WebLog.Post post, bool publish)
        {
            User user = ValidateUser(username, password);
            Blog blog = user.Blogs.First();

            //create the topic
            Topic newTopic = new Topic {
                UserId    = user.UserId,
                Visible   = false,
                Title     = post.title,
                Timestamp = DateTime.UtcNow
            };

            blog.Forum.Topics.Add(newTopic);

            //add the post for this topic
            newTopic.Posts.Add(new Fudge.Framework.Database.Post {
                Message   = post.description,
                Title     = post.title,
                Visible   = publish,
                Timestamp = DateTime.UtcNow,
                Rating    = new Rating(),
                UserId    = user.UserId
            });

            db.SubmitChanges();
            //subscribe to the topic
            user.SubscribeForReplies(newTopic.TopicId);

            return(newTopic.TopicId.ToString());
        }
Ejemplo n.º 2
0
        public bool editPost(string postid, string username, string password, Westwind.WebLog.Post post, bool publish)
        {
            Topic topic = GetBlogPost(username, password, postid);

            //update the message
            topic.Posts[0].Message = post.description;
            topic.Title            = post.title;
            topic.Timestamp        = DateTime.UtcNow;

            db.SubmitChanges();
            return(true);
        }