@model MvcAuction.Model.Auction
@{
var aution = Model;
}
<p>Start Time: @aution.StartTime.ToString("g")</p>
@*
i'm the comments
*@
--------------------------------------------------------
more than one instance:
@model IEnumerable<MvcAuction.Models.Auction>
@{
viewBag.Title = "Index";
}
<tr>
<th>
@Html.DisplayNameFor(model => model.Title)
</th>
VIEW作成PARTIAL,為了增加利用率,方便維護(只維護一份就可以了)
MVC 4 Part - 4 Reusing logic and managing complexity with partial views
MVC 4 Part - 5 Using layouts to create a consistent theme
MVC 4 Part - 6 Creating a content page that uses a layout file
_ViewStart.cs is a great place to store things you want to excute in every views.
by default it only contents :
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
MVC 4 Part - 7 Applying advanced layout techniques
MVC 4 Part - 8 Organizing access to your app with routing
MVC 4 Part - 9 How routing finds controller actions (?)
MVC 4 Part - 10 Combating routing ambiguity
MVC 4 Part - 11 Creating a form with HTML form helpers
MVC 4 Part - 12 Automatically binding to data in the request