Добавил страницу для отображения деталей продукта

parent f2a35b29
......@@ -33,5 +33,17 @@ namespace Store.Controllers
return View();
}
public IActionResult Details(string id)
{
return View(new Product
{
Id = Guid.NewGuid().ToString(),
Name = "Asus A674",
Amount = 150,
Brand = "Asus",
Category = "TV"
});
}
}
}
......@@ -57,6 +57,9 @@ namespace Store
{
routes.MapRoute(
name: "default", template: "{controller=Product}/{action=Index}");
routes.MapRoute(
name: "details", template: "{controller=Product}/{action=Details}/{id}");
});
}
}
......
@model Store.Models.Product
@{
Layout = "_MainLayout";
}
<h2>Product details:</h2>
<table class="table">
<tbody>
<tr>
<td>Name:</td>
<td>@Model.Name</td>
</tr>
<tr>
<td>Category:</td>
<td>@Model.Category</td>
</tr>
<tr>
<td>Brand:</td>
<td>@Model.Brand</td>
</tr>
<tr>
<td>Amount:</td>
<td>@Model.Amount</td>
</tr>
</tbody>
</table>
......@@ -22,7 +22,7 @@
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="/Product/Index">Home</a>
<a href="/Product/Index">Main</a>
</li>
</ul>
</div>
......@@ -39,7 +39,6 @@
</footer>
</div>
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment