Добавил контроллер ProductController.cs и представление Index

parent 0fe19a8b
using Microsoft.AspNetCore.Mvc;
namespace Store.Controllers
{
public class ProductController : Controller
{
public IActionResult Index()
{
return View();
}
}
}
{ {
"iisSettings": { "iisSettings": {
"windowsAuthentication": false, "windowsAuthentication": false,
"anonymousAuthentication": true, "anonymousAuthentication": true,
"iisExpress": { "iisExpress": {
"applicationUrl": "http://localhost:50787", "applicationUrl": "http://localhost:50787",
"sslPort": 44376 "sslPort": 44376
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
"Store": { "Store": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000", "applicationUrl": "https://localhost:9001;http://localhost:9000",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
} }
} }
} }
\ No newline at end of file
...@@ -52,7 +52,12 @@ namespace Store ...@@ -52,7 +52,12 @@ namespace Store
app.UseStaticFiles(); app.UseStaticFiles();
app.UseCookiePolicy(); app.UseCookiePolicy();
app.UseMvc(); app.UseMvc(
routes =>
{
routes.MapRoute(
name: "default", template: "{controller=Product}/{action=Index}");
});
} }
} }
} }
\ No newline at end of file
@{
Layout = "_MainLayout";
}
<h1>Hello</h1>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Store</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="/Product/Index">Home</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>&copy; 2019 - Store</p>
</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>
</body>
</html>
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