Adding a Blazor WASM app
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
@page "/cities"
|
||||
|
||||
<PageHeader Name="Villes" NameType="Liste" Link="/cities/create"></PageHeader>
|
||||
|
||||
<Card>
|
||||
<table class="table table-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th class="text-nowrap">Nom</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(Cities != null)
|
||||
{
|
||||
@foreach (var city in Cities)
|
||||
{
|
||||
<tr>
|
||||
<th>@city.Id</th>
|
||||
<td>@city.Name</td>
|
||||
</tr>
|
||||
}
|
||||
} else
|
||||
{
|
||||
<tr>
|
||||
<td colspan="2">Chargement...</td>
|
||||
</tr>
|
||||
|
||||
}
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</Card>
|
||||
@@ -0,0 +1,18 @@
|
||||
using CityInfo.WEB.Models;
|
||||
using CityInfo.WEB.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace CityInfo.WEB.Pages
|
||||
{
|
||||
public partial class CitiesOverview
|
||||
{
|
||||
[Inject]
|
||||
public ICityDataService CityDataService { get; set; } = default!;
|
||||
public IEnumerable<City> Cities { get; set; }
|
||||
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
Cities = await CityDataService.GetCities();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@page "/"
|
||||
@page "/home"
|
||||
|
||||
<PageTitle>Home</PageTitle>
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
Welcome to your new app.
|
||||
@@ -0,0 +1,5 @@
|
||||
@page "/not-found"
|
||||
@layout MainLayout
|
||||
|
||||
<h3>Not Found</h3>
|
||||
<p>Sorry, the content you are looking for does not exist.</p>
|
||||
@@ -0,0 +1,7 @@
|
||||
@page "/city/{CityId:int}/pointsofinterest"
|
||||
|
||||
<PageHeader Name="Points d'intérets" NameType="Liste" Link="/pointsofinterest/create"></PageHeader>
|
||||
|
||||
<Card>
|
||||
|
||||
</Card>
|
||||
@@ -0,0 +1,20 @@
|
||||
using CityInfo.WEB.Models;
|
||||
using CityInfo.WEB.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace CityInfo.WEB.Pages
|
||||
{
|
||||
public partial class PointsOfInterestOverview
|
||||
{
|
||||
[Inject]
|
||||
public IPointOfInterestDataService PointOfInterestDataService { get; set; }
|
||||
[Parameter]
|
||||
public int CityId { get; set; }
|
||||
public IEnumerable<PointOfInterest> PointsOfInterest { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
PointsOfInterest = await PointOfInterestDataService.GetPointsOfInterest(CityId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user