当前位置: 首页>>代码示例>>C#>>正文


C# Comment.Save方法代码示例

本文整理汇总了C#中Comment.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Comment.Save方法的具体用法?C# Comment.Save怎么用?C# Comment.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Comment的用法示例。


在下文中一共展示了Comment.Save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateComment

        public ActionResult CreateComment(string id, FormCollection collection)
        {
            int postId = 0;
            int.TryParse(id, out postId);
            Post post = Post.Find(postId);

            Comment comment = new Comment();
            comment.Post = post;
            comment.Auther = Request.Form["Author"];
            comment.DateAdded = DateTime.Now;
            comment.Text = Request.Form["Comment"];
            comment.Save();

            return Details(post.Id.ToString());
        }
开发者ID:Hotjava,项目名称:Practise_Code,代码行数:15,代码来源:BlogController.cs

示例2: Insert

        public void Insert(int? CommentType,string Comments,DateTime? DateAdded,string RoleAccess,string UserID,int? SourceType,int? SourceID,bool Deleted,DateTime? DateModified,DateTime? DeletedDate)
        {
            Comment item = new Comment();

            item.CommentType = CommentType;

            item.Comments = Comments;

            item.DateAdded = DateAdded;

            item.RoleAccess = RoleAccess;

            item.UserID = UserID;

            item.SourceType = SourceType;

            item.SourceID = SourceID;

            item.Deleted = Deleted;

            item.DateModified = DateModified;

            item.DeletedDate = DeletedDate;

            item.Save(UserName);
        }
开发者ID:unepwcmc,项目名称:sigtrade,代码行数:26,代码来源:CommentController.cs

示例3: CommentSave_Click

    protected void CommentSave_Click(object sender, EventArgs e)
    {
        Comment comment = new Comment(Request.QueryString["id"]);
        if (comment.IsNew)
            throw new Exception("Invalid Comment Id");

        comment.Body = CommentEditor.Text;
        comment.Name = Server.HtmlEncode(txtName.Text);
        comment.WebSite = txtSite.Text;
        comment.Email = txtEmail.Text;
        comment.Save();

        Response.Redirect("~/graffiti-admin/comments/");
    }
开发者ID:chartek,项目名称:graffiticms,代码行数:14,代码来源:Default.aspx.cs

示例4: UpdateComment

        private static string UpdateComment(XmlDocument doc, IGraffitiUser user)
        {
            int id = Int32.Parse(doc.SelectSingleNode("/comment").Attributes["id"].Value);

            Comment comment = new Comment(id);
            if(comment.IsNew)
                throw new Exception("Comment with id " + id + " does not exist. The REST API only supports updating existing comments at this time.");

            XmlNode node = doc.SelectSingleNode("/comment");

            comment.Body = GetNodeValue(node.SelectSingleNode("body"), comment.Body);
            comment.Name = GetNodeValue(node.SelectSingleNode("name"), comment.Name);
            comment.IsPublished = GetNodeValue(node.SelectSingleNode("isPublished"), comment.IsPublished);
            comment.IsDeleted = GetNodeValue(node.SelectSingleNode("isDeleted"), comment.IsDeleted);
            comment.SpamScore = GetNodeValue(node.SelectSingleNode("spamScore"), comment.SpamScore);
            comment.Email = GetNodeValue(node.SelectSingleNode("email"), comment.Email);
            comment.WebSite = GetNodeValue(node.SelectSingleNode("webSite"), comment.WebSite);

            if (!RolePermissionManager.GetPermissions(comment.Post.CategoryId, user).Edit)
                throw new Exception("You do not have sufficient privileges to update this comment.");

            comment.Save(GraffitiUsers.Current.Name);

            return "<result id=\"" + id + "\">true</result>";
        }
开发者ID:chartek,项目名称:graffiticms,代码行数:25,代码来源:CommentResource.cs

示例5: CommentList_OnItemCommand

    protected void CommentList_OnItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        int count = 0;

        switch (e.CommandName)
        {
            case "Delete":

                foreach (RepeaterItem item in CommentList.Items)
                {
                    int id = Convert.ToInt32(((HiddenField)item.FindControl("CommentID")).Value);

                    if (((CheckBox)item.FindControl("CommentCheckbox")).Checked)
                    {
                        Comment.Delete(id);
                        count++;
                    }
                }

                CommentStatus.Text = "You have deleted " + count.ToString() + " comment(s).";

                break;

            case "Approve":

                foreach (RepeaterItem item in CommentList.Items)
                {
                    int id = Convert.ToInt32(((HiddenField)item.FindControl("CommentID")).Value);

                    if (((CheckBox)item.FindControl("CommentCheckbox")).Checked)
                    {
                        Comment cmt = new Comment(id);
                        cmt.IsDeleted = false;
                        cmt.IsPublished = true;
                        cmt.Save();

                        count++;
                    }
                }

                CommentStatus.Text = "You have approved " + count.ToString() + " comment(s).";

                break;

            case "Undelete":

                foreach (RepeaterItem item in CommentList.Items)
                {
                    int id = Convert.ToInt32(((HiddenField)item.FindControl("CommentID")).Value);

                    if (((CheckBox)item.FindControl("CommentCheckbox")).Checked)
                    {
                        Comment comment = new Comment(id);
                        comment.IsDeleted = false;
                        comment.Save();

                        count++;
                    }
                }

                CommentStatus.Text = "You have undeleted " + count.ToString() + " comment(s).";

                break;
        }

        if (count == 0)
        {
            CommentStatus.Type = StatusType.Warning;
            CommentStatus.Text = "No comments were selected.";
        }
        else
        {
            CommentStatus.Type = StatusType.Success;
        }

        BuildPage();
    }
开发者ID:chartek,项目名称:graffiticms,代码行数:77,代码来源:Default.aspx.cs


注:本文中的Comment.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。