pull/9/head
Kentin BRONGNIART 4 months ago
parent 0c924c61f4
commit 9600e3243b

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34723.18
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WF-WebAdmin", "WF-WebAdmin\WF-WebAdmin.csproj", "{0E8D1007-ADDC-4103-847D-8EE48ACCDC62}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WF-WebAdmin", "WF-WebAdmin\WF-WebAdmin.csproj", "{0E8D1007-ADDC-4103-847D-8EE48ACCDC62}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

@ -0,0 +1,14 @@
namespace WF_WebAdmin.Model
{
public class Quote
{
public int Id { get; set; }
public string Content { get; set; }
public string Charac { get; set; }
public string ImgPath { get; set; }
public string TitleSrc { get; set; }
public DateTime DateSrc { get; set; }
public int Like { get; set; }
public string Langue { get; set; }
}
}

@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Components;
using WF_WebAdmin.Model;
namespace WF_WebAdmin.Pages
{
public partial class Accueil
{
private Quote[] quotes;
[Inject]
public HttpClient Http { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
protected override async Task OnInitializedAsync()
{
quotes = await Http.GetFromJsonAsync<Quote[]>($"{NavigationManager.BaseUri}fake-data.json");
}
}
}

@ -0,0 +1,38 @@
@page "/"
<PageTitle>Accueil</PageTitle>
<h1>Accueil</h1>
@if (quotes != null)
{
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Content</th>
<th>Charactére</th>
<th>Title Source</th>
<th>Like</th>
<th>Langue</th>
<th>Date Source</th>
</tr>
</thead>
<tbody>
@foreach (var quote in quotes)
{
<tr>
<td>@quote.Id</td>
<td>@quote.Content</td>
<td>@quote.Charac</td>
<td>@quote.TitleSrc</td>
<td>@quote.Like</td>
<td>@quote.Langue</td>
<td>@quote.DateSrc.ToShortDateString()</td>
</tr>
}
</tbody>
</table>
}

@ -1,18 +0,0 @@
@page "/counter"
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
private void IncrementCount()
{
currentCount++;
}
}

@ -1,48 +0,0 @@
@page "/fetchdata"
<PageTitle>Weather forecast</PageTitle>
@using WF_WebAdmin.Data
@inject WeatherForecastService ForecastService
<h1>Weather forecast</h1>
<p>This component demonstrates fetching data from a service.</p>
@if (forecasts == null)
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}
@code {
private WeatherForecast[]? forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
}
}

@ -1,9 +0,0 @@
@page "/"
<PageTitle>Index</PageTitle>
<h1>Hello, world!</h1>
Welcome to your new app.
<SurveyPrompt Title="How is Blazor working for you?" />

@ -0,0 +1,4 @@
@page "/Quiz"
<h3>Quiz</h3>

@ -0,0 +1,5 @@
@page "/ValidQuote"
<h3>ValidQuote</h3>

@ -9,6 +9,8 @@ builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddHttpClient();
var app = builder.Build();
// Configure the HTTP request pipeline.

@ -11,17 +11,17 @@
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Home
<span class="oi oi-home" aria-hidden="true"></span> Accueil
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="counter">
<span class="oi oi-plus" aria-hidden="true"></span> Counter
<NavLink class="nav-link" href="Quiz">
<span class="oi oi-plus" aria-hidden="true"></span> Quiz
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="fetchdata">
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
<NavLink class="nav-link" href="ValidQuote">
<span class="oi oi-list-rich" aria-hidden="true"></span> ValidQuote
</NavLink>
</div>
</nav>

@ -1,16 +0,0 @@
<div class="alert alert-secondary mt-4">
<span class="oi oi-pencil me-2" aria-hidden="true"></span>
<strong>@Title</strong>
<span class="text-nowrap">
Please take our
<a target="_blank" class="font-weight-bold link-dark" href="https://go.microsoft.com/fwlink/?linkid=2149017">brief survey</a>
</span>
and tell us what you think.
</div>
@code {
// Demonstrates how a parent component can supply parameters
[Parameter]
public string? Title { get; set; }
}

@ -0,0 +1,22 @@
[
{
"Id": 1,
"Content": "coucou",
"Charac": "moi",
"ImgPath": "img",
"TitleSrc": "G4",
"DateSrc": "2001-01-01",
"Like": 20,
"Langue": "fr"
},
{
"Id": 2,
"Content": "boujour",
"Charac": "toi",
"ImgPath": "img",
"TitleSrc": "G4",
"DateSrc": "2002-02-02",
"Like": 0,
"Langue": "fr"
}
]
Loading…
Cancel
Save