From 8dff8292b3f8a0f4ab065057277ba8cc4da72451 Mon Sep 17 00:00:00 2001 From: Jason Zhu Date: Sat, 18 Sep 2021 18:34:56 +1000 Subject: [PATCH] 8.2 Building the Shopping Cart; Listing 8-17. The Contents of the Index.cshtml File --- .../SportsStore.WebUI.csproj | 2 +- .../SportsStore.WebUI/Views/Cart/Index.cshtml | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 SportsStore/SportsStore.WebUI/Views/Cart/Index.cshtml diff --git a/SportsStore/SportsStore.WebUI/SportsStore.WebUI.csproj b/SportsStore/SportsStore.WebUI/SportsStore.WebUI.csproj index 4de9405..1bd5eb2 100644 --- a/SportsStore/SportsStore.WebUI/SportsStore.WebUI.csproj +++ b/SportsStore/SportsStore.WebUI/SportsStore.WebUI.csproj @@ -152,6 +152,7 @@ + Web.config @@ -161,7 +162,6 @@ - diff --git a/SportsStore/SportsStore.WebUI/Views/Cart/Index.cshtml b/SportsStore/SportsStore.WebUI/Views/Cart/Index.cshtml new file mode 100644 index 0000000..62a3f92 --- /dev/null +++ b/SportsStore/SportsStore.WebUI/Views/Cart/Index.cshtml @@ -0,0 +1,42 @@ +@model SportsStore.WebUI.Models.CartIndexViewModel + +@{ + ViewBag.Title = "Sports Store: Your Cart"; +} + +

Your cart

+ + + + + + + + + + + @foreach (var line in Model.Cart.Lines) { + + + + + + + } + + + + + + + +
QuantityItemPriceSubtotal
@line.Quantity@line.Product.Name@line.Product.Price.ToString("c") + @((line.Quantity * line.Product.Price).ToString("c")) +
Total: + @Model.Cart.ComputeTotalValue().ToString("c") +
+ + +