Добавил страницу с подробным описанием телефона.

#1
parent ab51e8bc
...@@ -137,12 +137,12 @@ namespace PhoneStore.Controllers ...@@ -137,12 +137,12 @@ namespace PhoneStore.Controllers
} }
[HttpGet] [HttpGet]
public IActionResult About(int? id) public IActionResult About(int? phoneId)
{ {
if (!id.HasValue) return RedirectToAction("Error", "Errors", new {statusCode = 777}); if (!phoneId.HasValue) return RedirectToAction("Error", "Errors", new {statusCode = 777});
var phone = _db.Phones var phone = _db.Phones
.Include(p => p.Brand) .Include(p => p.Brand)
.FirstOrDefault(p => p.Id == id); .FirstOrDefault(p => p.Id == phoneId);
if (phone is null) if (phone is null)
return RedirectToAction("Error", "Errors", new {statusCode = 777}); return RedirectToAction("Error", "Errors", new {statusCode = 777});
......
...@@ -6,3 +6,10 @@ ...@@ -6,3 +6,10 @@
} }
<h2>@Model.Name</h2> <h2>@Model.Name</h2>
<div class="card mb-3">
<img class="card-img-top w-50" src="~/@Model.Image" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">@Model.Brand.Name</h5>
<p class="card-text">@(Model.Price.ToString("C2"))</p>
</div>
</div>
\ No newline at end of file
...@@ -65,6 +65,12 @@ else ...@@ -65,6 +65,12 @@ else
class="dropdown-item"> class="dropdown-item">
Изменить Изменить
</a> </a>
<a asp-route-phoneId="@phone.Id"
asp-action="About"
asp-controller="Phones"
class="dropdown-item">
Подробнее
</a>
<a asp-route-phoneId="@phone.Id" <a asp-route-phoneId="@phone.Id"
asp-action="Delete" asp-action="Delete"
asp-controller="Phones" asp-controller="Phones"
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<p>@User.Identity.Name</p> <p>@User.Identity.Name</p>
<form method="post" asp-controller="Account" asp-action="LogOff"> <form method="post" asp-controller="Account" asp-action="LogOff">
<input type="submit" value="Выход" /> <button class="btn btn-outline-warning" type="submit">Выход</button>
</form> </form>
} }
else else
......
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