-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcart.cshtml
86 lines (76 loc) · 1.59 KB
/
cart.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
@using FreyaMusicStore
@{
Layout = "layout";
}
@section Main
{
<h3>
<em>Review</em> your cart:
</h3>
<p class="button">
<a href="@Uris.checkout">Checkout >></a>
</p>
<div id="update-message">
</div>
<table>
<tr>
<th>
Album Name
</th>
<th>
Price (each)
</th>
<th>
Quantity
</th>
<th></th>
</tr>
@foreach (var item in Model.CartItems)
{
<tr id="[email protected]">
<td>
<a href="@String.Format(Uris.album, item.AlbumId)">@item.Title</a>
</td>
<td>
@item.Price
</td>
<td id="[email protected]">
@item.Count
</td>
<td>
<a href="#" class="RemoveLink" data-id="@item.AlbumId">Remove from cart</a>
</td>
</tr>
}
<tr>
<td>
Total
</td>
<td></td>
<td></td>
<td id="cart-total">
@Model.CartTotal
</td>
</tr>
</table>
<script>
$(".RemoveLink").click(function() {
var albumId = $(this).attr("data-id");
var $count = $("#item-count-" + albumId);
var count = Number.parseInt( $count.val() );
if (albumId != '') {
var success = function (data) {
document.open();
document.write(data);
document.close();
};
$.ajax({
type: "DELETE",
url: window.location.pathname,
data: String.format("AlbumId={0}", albumId),
success: success
});
}
});
</script>
}