-3
私の小さなウェブサイトのサービスに問題があります。私はポストを壁にコードし、ユーザからのコメントをしなければならない。投稿の壁がいっぱいで、.NETでのコメント
public class Post
{
public int ID { get; set; }
public string PostContent { get; set; }
public DateTime PostDateTime { get; set; }
public virtual ApplicationUser ApplicationUser { get; set; }
public virtual ICollection<Comment> Comments { get; set; }
}
とコメントについて:私はビュー内のすべての記事、彼のコメントを表示することができますどのように
public class Comment
{
public int ID { get; set; }
public string CommentContent { get; set; }
public DateTime CommentDateTime { get; set; }
public int PostId { get; set; }
public virtual ApplicationUser ApplicationUser { get; set; }
public virtual Post Post { get; set; }
}
は、私はポストのためのいくつかのモデルがありますか?
どのようにすべての投稿+コメントを1ページに表示するのですか?どのように見えるか?どのようにコントローラのように見えるのですか?あなたはあなたが投稿とコメントに対して別々のdivであなたのHTMLページを作成するだけででき モデルPostAndCommentsに合格しているCSHTMLページにアクセスしたらD – Zarobiek
[OK]を、私はそれをしようとしますどこかでテンプレートをとる) Model.PostContentとModel.CommentContentあなたが必要な場所 これらのコードはすべて手前に@が必要ですので、RazorエンジンはC#コード – Zarobiek
@Zarobiek(あるいは単に: –