From 905ecd6969d2899a3b3556495252e513ee78561d Mon Sep 17 00:00:00 2001 From: Jason Zhu Date: Mon, 13 Sep 2021 00:16:06 +1000 Subject: [PATCH] 8.2.2 Adding the Add to Cart Buttons; Listing 8-13. Adding the Buttons to the ProductSummary.cshtml File View --- .../SportsStore.WebUI/Views/Shared/ProductSummary.cshtml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SportsStore/SportsStore.WebUI/Views/Shared/ProductSummary.cshtml b/SportsStore/SportsStore.WebUI/Views/Shared/ProductSummary.cshtml index 2eb255e..7b94b01 100644 --- a/SportsStore/SportsStore.WebUI/Views/Shared/ProductSummary.cshtml +++ b/SportsStore/SportsStore.WebUI/Views/Shared/ProductSummary.cshtml @@ -5,5 +5,14 @@ @Model.Name @Model.Price.ToString("c") + + @using (Html.BeginForm("AddToCart", "Cart")) + { +
+ @Html.HiddenFor(x => x.ProductID) + @Html.Hidden("returnUrl", Request.Url.PathAndQuery) + +
+ } @Model.Description