Exercise Files
This commit is contained in:
108
Ch04/04_01_End/Website/Views/Cart/Cart.cshtml
Normal file
108
Ch04/04_01_End/Website/Views/Cart/Cart.cshtml
Normal file
@ -0,0 +1,108 @@
|
||||
@model HPlusSports.Models.ShoppingCart
|
||||
|
||||
@{
|
||||
ViewBag.Title = "My Cart";
|
||||
}
|
||||
|
||||
@if (TempData.SuccessMessage() != null)
|
||||
{
|
||||
<div class="alert alert-success alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
@TempData.SuccessMessage()
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="cart row">
|
||||
|
||||
<div>
|
||||
<hr />
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-1">
|
||||
</th>
|
||||
<th class="col-md-6">
|
||||
Product
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
Quantity
|
||||
</th>
|
||||
<th class="col-md-2">
|
||||
Price
|
||||
</th>
|
||||
<th class="col-md-2">
|
||||
Subtotal
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.Items)
|
||||
{
|
||||
<tr class="text-middle">
|
||||
<td>
|
||||
<a href="@Url.Action("Remove", "Cart", new { id = item.Id })">
|
||||
<i class="glyphicon glyphicon-remove text-danger"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="@Url.Product(item.SKU)">
|
||||
<img class="product-image img-thumbnail" src="@Url.Action("Product", "Images", new { id = item.SKU })" />
|
||||
<span>@item.Name</span>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="@Url.Action("Add", "Cart", new { item.SKU, quantity = -1 })">
|
||||
<i class="glyphicon glyphicon-minus"></i>
|
||||
</a>
|
||||
@item.Quantity
|
||||
<a href="@Url.Action("Add", "Cart", new { item.SKU })">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
@item.Price.ToString("C")
|
||||
</td>
|
||||
<td>
|
||||
@item.Total.ToString("C")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="text-primary">
|
||||
<td colspan="4" class="text-right">
|
||||
Subtotal
|
||||
</td>
|
||||
<td>
|
||||
@Model.Subtotal.ToString("C")
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-muted">
|
||||
<td colspan="4" class="text-right">
|
||||
Tax
|
||||
</td>
|
||||
<td>
|
||||
@Model.Tax.ToString("C")
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-muted">
|
||||
<td colspan="4" class="text-right">
|
||||
Shipping
|
||||
</td>
|
||||
<td>
|
||||
@Model.Shipping.ToString("C")
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-primary text-large">
|
||||
<th colspan="4" class="text-right">
|
||||
Total
|
||||
</th>
|
||||
<th>
|
||||
@Model.Total.ToString("C")
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
16
Ch04/04_01_End/Website/Views/Cart/EmptyCart.cshtml
Normal file
16
Ch04/04_01_End/Website/Views/Cart/EmptyCart.cshtml
Normal file
@ -0,0 +1,16 @@
|
||||
@model HPlusSports.Models.ShoppingCart
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Cart";
|
||||
}
|
||||
|
||||
<div class="row">
|
||||
<div class="well well-lg">
|
||||
<p>Your shopping cart is empty!</p>
|
||||
<p>
|
||||
Head on over to
|
||||
@Html.ActionLink("the Product Catalog", "Index", "Products")
|
||||
to find something!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user