Пример #1
0
        public IBarelyView New(string entryid, CommentData post)
        {
            if (Form["Link"] != "")
            {
                return(null);
            }
            post.Name      = post.Name.Substring(0, Math.Min(post.Name.Length, 32));
            post.Text      = post.Text.Substring(0, Math.Min(post.Text.Length, 1024));
            post.IPAddress = Request.UserHostAddress;
            post.UserAgent = Request.UserAgent;
            post.Text      = CheckLines(post.Text);
            if (post.Text == "OOONNNNYYYYTTTTIIIII")
            {
                throw new HttpException(500, "F**k you.");
            }
            BlogEntryData entry = BlogEntryData.Get(entryid);

            if (entry == null)
            {
                throw new HttpException(404, "Blog entry not found");
            }
            post.EntryID = entry.ID;
            post.Posted  = DateTime.Now;
            post.Save();
            BlogEntryData.RecalculateComments(entry.ID);
            Response.Redirect(BlogHandler.GetUrl(entry));
            return(null);
        }
Пример #2
0
        public IBarelyView Delete(string id)
        {
            var comment = CommentData.Get(new ObjectId(id));

            CommentData.Delete(id);
            BlogEntryData.RecalculateComments(comment.EntryID);
            return(new WrapperView("Deleted comment"));
        }
Пример #3
0
 public IBarelyView RecalculateCommentCounts()
 {
     foreach (var entry in BlogEntryData.All().FindAllAs <BlogEntryData>())
     {
         BlogEntryData.RecalculateComments(entry.ID);
     }
     return(new WrapperView("Complete!"));
 }