I recently started using MVC, and as a test project I am creating a simple "blog". I have got a basic structure in place where the main page displays all the posts and when you click on it it will go into the detail page.I also have a separate page to add posts.
Now I am trying to add comments to my posts (Home/Details), which basically requires me to have 2 models in 1 view, and I am unsure on how to do this.This is the code for my details view:\[code\]@model MVCPortfolio.Models.Post@{ ViewBag.Title = "Details";}<h2>@Model.Title - @Model.Author</h2><fieldset> <legend>Posted on @Model.Date.ToShortDateString()</legend> <div class="content"> @Model.Content </div></fieldset> <div class="comments"> <ul> @foreach (var c in Model.Comments) { <li> @c.Content - @c.Author </li> } </ul> </div><div class="newcomment"></div><p> @Html.ActionLink("New Comment", "Comment", new { id = Model.PostId }) | @Html.ActionLink("Back to List", "Index")</p>\[/code\]Thank you for your time,Thomas