发表评论

时间:2012-03-08 03:08:41

标签: c# asp.net-mvc-3

<div>
@using(Html.BeginForm("AddComment", "Thread", mod))
{
<input type="text" name="AddComment" id="text" />
<input type="submit" value="Save"/>
}
</div>

在我的网站中,我有一个线程类,允许在每个线程上进行注释。加载网站时,我希望将每个线程加载到一个列表中,并同时加载已加载的线程上的每个注释。我如何使用上面的代码在现有线程上添加另一条注释?每当我提交它时告诉我模型状态无效。

这是线程类或模型:

public Thread()
    {
        this.ChildComments = new HashSet<Comment>();
    }

    public int Id { get; set; }
    public string TopicHeader { get; set; }
    public string TopicBody { get; set; }
    public Nullable<int> UpVotes { get; set; }
    public Nullable<int> DownVotes { get; set; }
    public int ProfileId { get; set; }
    public int TagId { get; set; }

    public virtual Profile Profile { get; set; }
    public virtual ICollection<Comment> ChildComments { get; set; }
    public virtual Tag ThreadTag { get; set; }

0 个答案:

没有答案
相关问题