From 2d6e9106a31fe423ff579f646dc06cd82996ea0f Mon Sep 17 00:00:00 2001 From: Eric Fleming Date: Sat, 12 Jan 2019 19:11:26 -0500 Subject: [PATCH 1/4] Setting Cookie to IsEssential to fix anonymous signin --- src/WebRazorPages/Pages/Basket/Index.cshtml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebRazorPages/Pages/Basket/Index.cshtml.cs b/src/WebRazorPages/Pages/Basket/Index.cshtml.cs index 904bf6f..fd7e42a 100644 --- a/src/WebRazorPages/Pages/Basket/Index.cshtml.cs +++ b/src/WebRazorPages/Pages/Basket/Index.cshtml.cs @@ -84,7 +84,7 @@ namespace Microsoft.eShopWeb.RazorPages.Pages.Basket if (_username != null) return; _username = Guid.NewGuid().ToString(); - var cookieOptions = new CookieOptions(); + var cookieOptions = new CookieOptions { IsEssential = true }; cookieOptions.Expires = DateTime.Today.AddYears(10); Response.Cookies.Append(Constants.BASKET_COOKIENAME, _username, cookieOptions); } From 007fb6a0affa4294fa599449674f44238f3d6b25 Mon Sep 17 00:00:00 2001 From: Eric Fleming Date: Sat, 12 Jan 2019 20:10:55 -0500 Subject: [PATCH 2/4] Display 2 decimal places for Total on Basket screen --- src/WebRazorPages/Pages/Basket/Index.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebRazorPages/Pages/Basket/Index.cshtml b/src/WebRazorPages/Pages/Basket/Index.cshtml index 5aa5959..c1dc5f4 100644 --- a/src/WebRazorPages/Pages/Basket/Index.cshtml +++ b/src/WebRazorPages/Pages/Basket/Index.cshtml @@ -57,7 +57,7 @@
-
$ @Model.BasketModel.Total()
+
$ @Model.BasketModel.Total().ToString("N2")
From fa9b04f53ded1b19dd424de9679bcb7aac8f4d6f Mon Sep 17 00:00:00 2001 From: Eric Fleming Date: Tue, 15 Jan 2019 20:09:25 -0500 Subject: [PATCH 3/4] Moving Components directory in to Shared - Based on the Microsoft documentation, they recommend you put the Components directory inside of Shared. https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-components?view=aspnetcore-2.2 --- .../Pages/{ => Shared}/Components/Basket/Default.cshtml | 0 src/WebRazorPages/WebRazorPages.csproj | 4 ++++ 2 files changed, 4 insertions(+) rename src/WebRazorPages/Pages/{ => Shared}/Components/Basket/Default.cshtml (100%) diff --git a/src/WebRazorPages/Pages/Components/Basket/Default.cshtml b/src/WebRazorPages/Pages/Shared/Components/Basket/Default.cshtml similarity index 100% rename from src/WebRazorPages/Pages/Components/Basket/Default.cshtml rename to src/WebRazorPages/Pages/Shared/Components/Basket/Default.cshtml diff --git a/src/WebRazorPages/WebRazorPages.csproj b/src/WebRazorPages/WebRazorPages.csproj index ec17601..7594006 100644 --- a/src/WebRazorPages/WebRazorPages.csproj +++ b/src/WebRazorPages/WebRazorPages.csproj @@ -9,6 +9,10 @@ InProcess + + + + From 118f386c7cc90d8781dc5838ccfcf0e5b4eda542 Mon Sep 17 00:00:00 2001 From: Eric Fleming Date: Thu, 17 Jan 2019 20:33:00 -0500 Subject: [PATCH 4/4] Applying some style updates - Moving the total out of the foreach so it only displays once - Making the total display proper number of Decimals --- src/Web/Views/Basket/Index.cshtml | 48 +++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Web/Views/Basket/Index.cshtml b/src/Web/Views/Basket/Index.cshtml index 35b30b1..1cc318d 100644 --- a/src/Web/Views/Basket/Index.cshtml +++ b/src/Web/Views/Basket/Index.cshtml @@ -22,7 +22,7 @@
Cost
- @for (int i=0; i< Model.Items.Count; i++) + @for (int i = 0; i < Model.Items.Count; i++) { var item = Model.Items[i];
@@ -42,32 +42,32 @@
- @*
- @item.ProductId -
*@ - -
-
-
-
Total
-
- -
-
-
$ @Model.Total()
-
- -
-
-
- @**@ -
-
-
} + +
+
+
+
Total
+
+ +
+
+
$ @Model.Total().ToString("N2")
+
+ +
+
+
+ @**@ +
+
+
+
+ asp-action="Index"> + [ Update ] +