Random daily quote

master
Kentin BRONGNIART 3 months ago
parent 6b3a7283b5
commit dc8d2510af

@ -1,7 +1,9 @@
using Blazorise.DataGrid;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using System;
using System.Security.Claims;
using System.Text.Json;
using WF_WebAdmin.Model;
@ -32,9 +34,18 @@ namespace WF_WebAdmin.Pages
Dailyquote = await Http.GetFromJsonAsync<Quote[]>($"{NavigationManager.BaseUri}fake-dataDailyQuote.json");
}
private void RandomDailyquote()
private async void RandomDailyquote()
{
//fonction a compléter
string _jsonFilePath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "fake-dataDailyQuote.json");
Random random = new Random();
Quote[] quotes = await Http.GetFromJsonAsync<Quote[]>($"{NavigationManager.BaseUri}fake-dataQuote.json");
Dailyquote = new Quote[] { quotes.OrderBy(x => random.Next()).First() };
var json = JsonSerializer.Serialize(Dailyquote, new JsonSerializerOptions { WriteIndented = true });
await File.WriteAllTextAsync(_jsonFilePath, json);
LoggerSaveStub.Log(Logger, LogLevel.Information, "Random change of quote of the day");
}
}

@ -18,7 +18,6 @@
<PackageReference Include="MudBlazor" Version="6.2.0" />
<PackageReference Include="Npgsql" Version="9.0.2" />
<PackageReference Include="Blazored.Modal" Version="7.2.0" />
<PackageReference Include="Syncfusion.Blazor.Charts" Version="28.2.4" />
</ItemGroup>
</Project>

@ -1,12 +1,14 @@
[
{
"Id": "1",
"Content": "Dans le monde il ny a pas dun côté le bien et le mal, il y a une part de lumière et dombre en chacun de nous. Ce qui compte cest celle que lon choisit de montrer dans nos actes, ça cest ce que lon est vraiment.",
"Likes": 0,
"Id": 11,
"Content": "Vous ne pouvez pas vivre sans causer de dommages \u00E0 quelqu\u0027un d\u0027autre.",
"Like": 110,
"Langue": "fr",
"Charac": "Superman",
"TitleSrc": "SuperMan : le film",
"UserProposition": "joe",
"ImgPath": "https://tse4.mm.bing.net/th/id/OIP.fc5TQflh0cbxB1GUeOdk6gHaK8?w=123&h=180&c=7&r=0&o=5&pid=1.7"
"Charac": "test",
"ImgPath": "http://thematrix.com",
"TitleSrc": "The Matrix",
"DateSrc": "2025-01-21T00:00:00",
"UserProposition": "user11",
"IsValid": false
}
]

@ -171,6 +171,86 @@
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"
},
{
"LogLevel": 2,
"Message": "Random change of quote of the day"

Loading…
Cancel
Save