diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index a7b60b5..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- // Use IntelliSense to find out which attributes exist for C# debugging
- // Use hover for the description of the existing attributes
- // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
- "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
deleted file mode 100644
index ed120a7..0000000
--- a/.vscode/tasks.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "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
deleted file mode 100644
index e0b21d4..0000000
--- a/Client/Pages/Cart/Cart.razor
+++ /dev/null
@@ -1,11 +0,0 @@
-@inherits CartBase
-@page "/cart"
-
-
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
deleted file mode 100644
index 650deef..0000000
--- a/Client/Pages/Cart/Cart.razor.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-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()
- {
- await ReloadCart();
- }
-
- protected void RemoveItem(Details.Model.LineItem item)
- {
- Model.Items.Remove(item);
- }
-
- protected async Task ReloadCart()
- {
- 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
deleted file mode 100644
index 8b363c1..0000000
--- a/Client/Pages/Cart/Item.razor
+++ /dev/null
@@ -1,20 +0,0 @@
-@inherits ItemBase
-
-
-
-
- £@Details.Price
-
-
\ No newline at end of file
diff --git a/Client/Pages/Cart/Item.razor.cs b/Client/Pages/Cart/Item.razor.cs
deleted file mode 100644
index 5d32688..0000000
--- a/Client/Pages/Cart/Item.razor.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using Microsoft.AspNetCore.Components;
-using ShoppingCartStarter.Shared.Cart;
-using ShoppingCartStarter.Shared.Cart.LineItem;
-using System;
-using System.Net.Http;
-using System.Net.Http.Json;
-using System.Threading.Tasks;
-
-namespace ShoppingCartStarter.Client.Pages.Cart
-{
- public class ItemBase : ComponentBase
- {
- [Parameter]
- public Details.Model.LineItem Details { get; set; }
-
- [Inject]
- public HttpClient Http { get; set; }
-
- [Parameter]
- public EventCallback OnDeleted { get; set; }
-
- [Parameter]
- public EventCallback OnQuantityChanged { get; set; }
-
- protected async Task OnDeleteClicked()
- {
- await Http.DeleteAsync($"api/cart/lines/{Details.Id}");
- await OnDeleted.InvokeAsync(Details);
- }
-
- protected async Task QuantityChanged(int value)
- {
- await Http.PutAsJsonAsync("api/cart/lines", new Update.Command
- {
- Id = Details.Id,
- Quantity = value
- });
-
- await OnQuantityChanged.InvokeAsync(EventArgs.Empty);
- }
- }
-}
\ No newline at end of file
diff --git a/Client/Pages/Cart/Quantity.razor b/Client/Pages/Cart/Quantity.razor
deleted file mode 100644
index be13714..0000000
--- a/Client/Pages/Cart/Quantity.razor
+++ /dev/null
@@ -1,9 +0,0 @@
-@inherits QuantityBase
-
-
\ No newline at end of file
diff --git a/Client/Pages/Cart/Quantity.razor.cs b/Client/Pages/Cart/Quantity.razor.cs
deleted file mode 100644
index 9051736..0000000
--- a/Client/Pages/Cart/Quantity.razor.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.AspNetCore.Components;
-using System;
-using System.Threading.Tasks;
-
-namespace ShoppingCartStarter.Client.Pages.Cart
-{
- public class QuantityBase : ComponentBase
- {
- [Parameter] public EventCallback ValueChanged { get; set; }
-
- [Parameter] public int Value { get; set; }
-
- protected Task OnChange(ChangeEventArgs e)
- {
- Value = Convert.ToInt32(e.Value);
- return ValueChanged.InvokeAsync(Value);
- }
- }
-}
\ No newline at end of file
diff --git a/Server/Data/Database.cs b/Server/Data/Database.cs
index 47c1505..ec78c10 100644
--- a/Server/Data/Database.cs
+++ b/Server/Data/Database.cs
@@ -17,14 +17,14 @@ namespace ShoppingCartStarter.Server.Data
{
using var serviceScope = app.ApplicationServices.GetService().CreateScope();
using var context = serviceScope.ServiceProvider.GetRequiredService();
-
+
context.Database.Migrate();
ShoppingCart cart;
if (context.Carts.Any())
{
cart = context.Carts
- .Include(x => x.LineItems)
+ .Include(x=>x.LineItems)
.FirstOrDefault();
}
else
diff --git a/Server/Properties/launchSettings.json b/Server/Properties/launchSettings.json
index 6f5995f..d591409 100644
--- a/Server/Properties/launchSettings.json
+++ b/Server/Properties/launchSettings.json
@@ -20,7 +20,7 @@
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
- "applicationUrl": "https://localhost:5004;http://localhost:5005",
+ "applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}