...

/

Solution: Implement a Category Detail Page

Solution: Implement a Category Detail Page

Take a look at the solution to the previous challenge.

Problem statement

The Northwind.MVC project is provided, which has a home page. Now, add the ability to show a detail page for a category by clicking on the “View” button.

Step-by-step solution

The changes we have made to the project are described below.

Let’s have a look at CategoryDetail.cshtml file:

Press + to interact
@model Packt.Shared.Category
@{
ViewData["Title"] = "Category Detail - " + Model.CategoryName;
}
<h2>Category Detail</h2>
<div>
<dl class="dl-horizontal">
<dt>Category Id</dt>
<dd>@Model.CategoryId</dd>
<dt>Product Name</dt>
<dd>@Model.CategoryName</dd>
<dt>Products</dt>
<dd>@Model.Products.Count</dd>
<dt>Description</dt>
<dd>@Model.Description</dd>
</dl>
</div>
...