Exemplo n.º 1
0
        private void LoadBlogComments(BlogMlExtendedPost blogX, XmlNode child)
        {
            foreach (XmlNode com in child.ChildNodes)
            {
                if (com.Attributes != null)
                {
                    var c = new ExtendedComment
                    {
                        CommentId    = GetAttributeValue <string>(com.Attributes["id"]),
                        Author       = GetAttributeValue <string>(com.Attributes["user-name"]),
                        Email        = GetAttributeValue <string>(com.Attributes["user-email"]),
                        IP           = GetAttributeValue <string>(com.Attributes["user-ip"]),
                        CreationTime = GetDate(com.Attributes["date-created"]),
                        Content      = "",
                        Website      = GetAttributeValue <string>(com, "user-url"),
                    };

                    var parentid = GetAttributeValue <string>(com.Attributes["parentid"]);
                    if (!string.IsNullOrEmpty(parentid))
                    {
                        c.ParentCommentId = parentid;
                    }

                    c.IsApproved = GetAttributeValue <bool>(com.Attributes["approved"]);

                    foreach (XmlNode comNode in com.ChildNodes)
                    {
                        if (comNode.Name == "content")
                        {
                            c.Content = comNode.InnerText;
                        }
                    }

                    if (blogX.Comments == null)
                    {
                        blogX.Comments = new List <ExtendedComment>();
                    }

                    blogX.Comments.Add(c);
                }
            }
        }
Exemplo n.º 2
0
        private void LoadBlogTrackbacks(BlogMlExtendedPost blogX, XmlNode child)
        {
            foreach (XmlNode com in child.ChildNodes)
            {
                if (com.Attributes != null)
                {
                    var c = new ExtendedComment
                    {
                        IP           = "127.0.0.1",
                        IsApproved   = GetAttributeValue <bool>(com.Attributes["approved"]),
                        CreationTime = GetDate(com.Attributes["date-created"])
                    };

                    if (!string.IsNullOrEmpty(GetAttributeValue <string>(com.Attributes["url"])))
                    {
                        c.Website = (GetAttributeValue <string>(com.Attributes["url"]));
                    }

                    foreach (XmlNode comNode in com.ChildNodes)
                    {
                        if (comNode.Name == "title")
                        {
                            c.Content = comNode.InnerText;
                        }
                    }

                    c.Email  = c.Content.Contains("pingback", StringComparison.InvariantCultureIgnoreCase) ? "pingback" : "trackback";
                    c.Author = c.Email;

                    if (blogX.Comments == null)
                    {
                        blogX.Comments = new List <ExtendedComment>();
                    }

                    blogX.Comments.Add(c);
                }
            }
        }
Exemplo n.º 3
0
 public async Task OnGetAsync()
 {
     // return the comments
     Comments = ExtendedComment.FromDb(await Db.Comments.ToListAsync(), await Db.CommentAnalyses.ToListAsync());
 }
Exemplo n.º 4
0
 public void OnGet()
 {
     // return the comments
     Comments = ExtendedComment.FromDb(Db.Comments.ToList(), Db.CommentAnalyses.ToList());
 }