9.2.1 Removing Items from the Cart; Listing 9-4 Introducing a Remove Button to the Index.cshtml File
parent
a8154783e7
commit
5636a37f58
|
@ -4,8 +4,14 @@
|
|||
ViewBag.Title = "Sports Store: Your Cart";
|
||||
}
|
||||
|
||||
@*Add style tag of cart table*@
|
||||
<style>
|
||||
#cartTable td { vertical-align: middle; }
|
||||
</style>
|
||||
|
||||
<h2>Your cart</h2>
|
||||
<table class="table">
|
||||
@*Add id*@
|
||||
<table id="cartTable" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Quantity</th>
|
||||
|
@ -23,6 +29,16 @@
|
|||
<td class="text-right">
|
||||
@((line.Quantity * line.Product.Price).ToString("c"))
|
||||
</td>
|
||||
@*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>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue