mirror of
https://github.com/rudollee/LearningMVC.git
synced 2026-08-11 16:32:55 +00:00
Ch. 20 View - WorkingWithRazor
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
@model string[]
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
@section Header {
|
||||
<div class="view">
|
||||
@foreach (string str in new[] { "Home", "List", "Edit" })
|
||||
{
|
||||
@Html.ActionLink(str, str, null, new { style = "margin: 5px" })
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@section Body {
|
||||
<div class="view">
|
||||
This is a list of fruit names:
|
||||
|
||||
@foreach (string name in Model)
|
||||
{
|
||||
<span><b>@name</b></span>
|
||||
<p />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@section Footer{
|
||||
<div class="View">
|
||||
This is the footer
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@model DateTime
|
||||
|
||||
<p>The time is: @Model.ToShortTimeString()</p>
|
||||
Reference in New Issue
Block a user