7.3.3 Setting the Default Route; e.g. 7.8 The List.cshtml View

chap07
Jason Zhu 2021-08-20 21:18:56 +10:00
parent 6217886a88
commit 1d1e1b3cc9
2 changed files with 16 additions and 1 deletions

View File

@ -136,7 +136,7 @@
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ProductrController.cs" />
<Compile Include="Controllers\ProductController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
@ -179,6 +179,7 @@
<Content Include="Views\Home\About.cshtml" />
<Content Include="Views\Home\Contact.cshtml" />
<Content Include="Views\Home\Index.cshtml" />
<Content Include="Views\Product\List.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View File

@ -0,0 +1,14 @@
@model IEnumerable<SportsStore.Domain.Entities.Product>
@{
ViewBag.Title = "Products";
}
@foreach (var p in Model)
{
<div class="item">
<h3>@p.Name</h3>
@p.Description
<h4>@p.Price.ToString("c")</h4>
</div>
}