From d35784c351afe846769cb1b7f6c8526a7f85a0f4 Mon Sep 17 00:00:00 2001 From: Green Hornet Date: Wed, 21 Apr 2021 08:27:14 -0400 Subject: [PATCH 1/5] Initial commit --- .vscode/launch.json | 14 +++++++++++ .vscode/tasks.json | 42 +++++++++++++++++++++++++++++++++ Client/Pages/Cart/Cart.razor | 11 +++++++++ Client/Pages/Cart/Cart.razor.cs | 20 ++++++++++++++++ Client/Pages/Cart/Item.razor | 16 +++++++++++++ Client/Pages/Cart/Item.razor.cs | 11 +++++++++ 6 files changed, 114 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 Client/Pages/Cart/Cart.razor create mode 100644 Client/Pages/Cart/Cart.razor.cs create mode 100644 Client/Pages/Cart/Item.razor create mode 100644 Client/Pages/Cart/Item.razor.cs diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..6609c18 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch and Debug Hosted Blazor WebAssembly App", + "type": "blazorwasm", + "request": "launch", + "hosted": true, + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/Server/bin/Debug/netcoreapp3.1/ShoppingCartStarter.Server.dll", + "cwd": "${workspaceFolder}/Server" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..ed120a7 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/Server/ShoppingCartStarter.Server.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/Server/ShoppingCartStarter.Server.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/Server/ShoppingCartStarter.Server.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/Client/Pages/Cart/Cart.razor b/Client/Pages/Cart/Cart.razor new file mode 100644 index 0000000..3a42137 --- /dev/null +++ b/Client/Pages/Cart/Cart.razor @@ -0,0 +1,11 @@ +@page "/cart" +@inherits CartBase + +

Your Shopping Cart

+ +@if(Model != null){ + @foreach (var line in Model.Items) + { + + } +} \ No newline at end of file diff --git a/Client/Pages/Cart/Cart.razor.cs b/Client/Pages/Cart/Cart.razor.cs new file mode 100644 index 0000000..e87dfff --- /dev/null +++ b/Client/Pages/Cart/Cart.razor.cs @@ -0,0 +1,20 @@ +using System.Net.Http; +using System.Net.Http.Json; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using ShoppingCartStarter.Shared.Cart; + +namespace ShoppingCartStarter.Client.Pages.Cart +{ + public class CartBase : ComponentBase + { + [Inject] private HttpClient Http { get; set; } + + protected Details.Model Model { get; set; } + + protected override async Task OnInitializedAsync() + { + Model = await Http.GetFromJsonAsync("api/cart"); + } + } +} \ No newline at end of file diff --git a/Client/Pages/Cart/Item.razor b/Client/Pages/Cart/Item.razor new file mode 100644 index 0000000..a8a06bf --- /dev/null +++ b/Client/Pages/Cart/Item.razor @@ -0,0 +1,16 @@ +@inherits ItemBase + +
+
+
+ Smart Speaker +
+

@Details.Name

+
+
+
+
+ @Details.Price +
+
\ No newline at end of file diff --git a/Client/Pages/Cart/Item.razor.cs b/Client/Pages/Cart/Item.razor.cs new file mode 100644 index 0000000..59075f5 --- /dev/null +++ b/Client/Pages/Cart/Item.razor.cs @@ -0,0 +1,11 @@ +using Microsoft.AspNetCore.Components; +using ShoppingCartStarter.Shared.Cart; + +namespace ShoppingCartStarter.Client.Pages.Cart +{ + public class ItemBase : ComponentBase + { + [Parameter] + public Details.Model.LineItem Details { get; set; } + } +} \ No newline at end of file From 564c109cd6f3f0ed412cedca00a64b37b17bb82a Mon Sep 17 00:00:00 2001 From: Green Hornet Date: Wed, 21 Apr 2021 08:47:13 -0400 Subject: [PATCH 2/5] change cart title --- Client/Pages/Cart/Cart.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/Pages/Cart/Cart.razor b/Client/Pages/Cart/Cart.razor index 3a42137..e4d7411 100644 --- a/Client/Pages/Cart/Cart.razor +++ b/Client/Pages/Cart/Cart.razor @@ -1,7 +1,7 @@ @page "/cart" @inherits CartBase -

Your Shopping Cart

+

Your New Shopping Cart

@if(Model != null){ @foreach (var line in Model.Items) From 244ebc2676c2c70d25d5e724f8fce58b9704236b Mon Sep 17 00:00:00 2001 From: Green Hornet Date: Wed, 21 Apr 2021 08:52:39 -0400 Subject: [PATCH 3/5] change title to include extra --- Client/Pages/Cart/Cart.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/Pages/Cart/Cart.razor b/Client/Pages/Cart/Cart.razor index e4d7411..4737151 100644 --- a/Client/Pages/Cart/Cart.razor +++ b/Client/Pages/Cart/Cart.razor @@ -1,7 +1,7 @@ @page "/cart" @inherits CartBase -

Your New Shopping Cart

+

Your Extra New Shopping Cart

@if(Model != null){ @foreach (var line in Model.Items) From 5f037fcaf8814b48f1edaf0b5ff1669335e007d8 Mon Sep 17 00:00:00 2001 From: Green Hornet Date: Wed, 21 Apr 2021 09:38:04 -0400 Subject: [PATCH 4/5] add super --- Client/Pages/Cart/Cart.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/Pages/Cart/Cart.razor b/Client/Pages/Cart/Cart.razor index 4737151..61b53f4 100644 --- a/Client/Pages/Cart/Cart.razor +++ b/Client/Pages/Cart/Cart.razor @@ -1,7 +1,7 @@ @page "/cart" @inherits CartBase -

Your Extra New Shopping Cart

+

Your Extra Super New Shopping Cart

@if(Model != null){ @foreach (var line in Model.Items) From 88e9a0ad73d2a7424763178288ae95b3abc7f8a8 Mon Sep 17 00:00:00 2001 From: Green Hornet Date: Wed, 21 Apr 2021 09:40:44 -0400 Subject: [PATCH 5/5] add duper --- Client/Pages/Cart/Cart.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/Pages/Cart/Cart.razor b/Client/Pages/Cart/Cart.razor index 61b53f4..1071abf 100644 --- a/Client/Pages/Cart/Cart.razor +++ b/Client/Pages/Cart/Cart.razor @@ -1,7 +1,7 @@ @page "/cart" @inherits CartBase -

Your Extra Super New Shopping Cart

+

Your Extra Super Duper New Shopping Cart

@if(Model != null){ @foreach (var line in Model.Items)