Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch2 #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
42 changes: 42 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
11 changes: 11 additions & 0 deletions Client/Pages/Cart/Cart.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@page "/cart"
@inherits CartBase

<h3>Your Extra Super Duper New Shopping Cart</h3>

@if(Model != null){
@foreach (var line in Model.Items)
{
<Item Details="@line"/>
}
}
20 changes: 20 additions & 0 deletions Client/Pages/Cart/Cart.razor.cs
Original file line number Diff line number Diff line change
@@ -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<Details.Model>("api/cart");
}
}
}
16 changes: 16 additions & 0 deletions Client/Pages/Cart/Item.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@inherits ItemBase

<div class="row border-bottom py-4">
<div class="col-sm">
<div class="media">
<img src="/images/test-image.jpg" altText="@Details.Name"
class="mr-3" alt="Smart Speaker"/>
<div class="media-body">
<h3>@Details.Name</h3>
</div>
</div>
</div>
<div class="col-sm-2">
@Details.Price
</div>
</div>
11 changes: 11 additions & 0 deletions Client/Pages/Cart/Item.razor.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}