2021-09-18 18:34:56 +10:00
|
|
|
@model SportsStore.WebUI.Models.CartIndexViewModel
|
|
|
|
|
|
|
|
@{
|
|
|
|
ViewBag.Title = "Sports Store: Your Cart";
|
|
|
|
}
|
|
|
|
|
2021-09-22 11:15:00 +10:00
|
|
|
@*Add style tag of cart table*@
|
|
|
|
<style>
|
|
|
|
#cartTable td { vertical-align: middle; }
|
|
|
|
</style>
|
|
|
|
|
2021-09-18 18:34:56 +10:00
|
|
|
<h2>Your cart</h2>
|
2021-09-22 11:15:00 +10:00
|
|
|
@*Add id*@
|
|
|
|
<table id="cartTable" class="table">
|
2021-09-18 18:34:56 +10:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Quantity</th>
|
|
|
|
<th>Item</th>
|
|
|
|
<th class="text-right">Price</th>
|
|
|
|
<th class="text-right">Subtotal</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach (var line in Model.Cart.Lines) {
|
|
|
|
<tr>
|
|
|
|
<td class="text-center">@line.Quantity</td>
|
|
|
|
<td class="text-left">@line.Product.Name</td>
|
|
|
|
<td class="text-right">@line.Product.Price.ToString("c")</td>
|
|
|
|
<td class="text-right">
|
|
|
|
@((line.Quantity * line.Product.Price).ToString("c"))
|
|
|
|
</td>
|
2021-09-22 11:15:00 +10:00
|
|
|
@*Add button*@
|
|
|
|
<td>
|
|
|
|
@using (Html.BeginForm("RemoveFromCart", "Cart"))
|
|
|
|
{
|
|
|
|
@Html.Hidden("ProductId", line.Product.ProductID)
|
|
|
|
@Html.HiddenFor(x => x.ReturnUrl)
|
|
|
|
<input class="btn btn-sm btn-warning"
|
|
|
|
type="submit" value="Remove" />
|
|
|
|
}
|
|
|
|
</td>
|
2021-09-18 18:34:56 +10:00
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</tbody>
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
|
|
<td colspan="3" class="text-right">Total:</td>
|
|
|
|
<td class="text-right">
|
|
|
|
@Model.Cart.ComputeTotalValue().ToString("c")
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<div class="text-center">
|
|
|
|
<a class="btn btn-primary" href="@Model.ReturnUrl">Continue shopping</a>
|
2021-09-22 11:37:26 +10:00
|
|
|
@Html.ActionLink("Checkout now", "Checkout", null, new { @class = "btn btn-primary" })
|
2021-09-18 18:34:56 +10:00
|
|
|
</div>
|
|
|
|
|