我有这两个模型类:
public class Article
{
public int ID { get; set; }
public string Title { get; set; }
public ICollection<Comment> Comments { get; set; }
}
public class Comment
{
public int ID { get; set; }
public int ArticleID { get; set; }
public string CommentTxt { get; set; }
public Article Article { get; set; }
}
public class ArticleDbContext : DbContext
{
public DbSet<Article> Articles { get; set; }
public DbSet<Comment> Comments { get; set; }
}
现在我想要一个页面,列出为一篇文章插入的所有评论,并且在列表的下面我可以为那篇文章插入新评论?