【问题标题】:Show comments and parent comments显示评论和家长评论
【发布时间】:2013-06-05 03:40:52
【问题描述】:

我无法显示 cmets。
这是我的表结构:

在我的 ViewModel 中:

// Comments
public ICollection<comments> Comments { get; set; }
// CommentText
public string _CommentText{ get; set; }
// CommentID
public int CommentID { get; set; }
// ParentCommentID
public int ParentCommentID { get; set; }

我想加载一个局部视图“_cmets.cshtml”,我在其中显示 cmets,您可以在其中添加评论。
有人知道我如何开始吗?我不知道如何展示 cmets。

我可以像这样通过我的存储库获取 cmets:

//COMMENTS
public IQueryable<string> GetComments(int itemID)
{
    return from comment in entities.comments
           where comment.item_id.Equals(itemID)
           select comment.comment_text;
}

【问题讨论】:

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


    【解决方案1】:

    您应该检查comment_parentid 字段。如果它为 null 或 0,那么它应该是特定项目的父评论。

    【讨论】:

      猜你喜欢
      • 2018-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-18
      • 2011-10-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多