56 lines
2.1 KiB
Plaintext
56 lines
2.1 KiB
Plaintext
@page
|
|
@model WebApp.Pages.CartModel
|
|
@{
|
|
ViewData["Title"] = "Cart";
|
|
}
|
|
<div class="container my-5">
|
|
<h1>Корзина</h1>
|
|
|
|
@* @if (Model.Amount == 0)
|
|
{
|
|
<p>Ваша корзина пуста.</p>
|
|
} *@
|
|
else
|
|
{
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Товар</th>
|
|
<th>Цена</th>
|
|
<th>Количество</th>
|
|
<th>Итого</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@* @foreach (var item in Model.CartItems)
|
|
{
|
|
<tr>
|
|
<td>
|
|
<div class="d-flex align-items-center">
|
|
<img src="data:image/png;base64,@Convert.ToBase64String(Model.GetMediaByProduct(item.Product))" class="img-fluid me-3" style="max-height: 50px;" alt="@item.Product.Name">
|
|
<a asp-page="ProductDetails" asp-route-id="@item.Product.Id">@item.Product.Name</a>
|
|
</div>
|
|
</td>
|
|
<td>@item.Product.Price.ToString("C")</td>
|
|
<td>
|
|
<input type="number" class="form-control" value="@item.Quantity" min="1" max="100" onchange="updateCartItem('@item.Product.Id', this.value)">
|
|
</td>
|
|
<td>@((item.Product.Price * item.Quantity).ToString("C"))</td>
|
|
<td>
|
|
<button class="btn btn-danger" onclick="removeFromCart('@item.Product.Id')">Удалить</button>
|
|
</td>
|
|
</tr>
|
|
} *@
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="d-flex justify-content-end">
|
|
@* <h3>Итого: @Model.TotalPrice.ToString("C")</h3> *@
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-end">
|
|
<a asp-page="Checkout" class="btn btn-primary">Оформить заказ</a>
|
|
</div>
|
|
}
|
|
</div> |