From 6903d55d68aa9755d689aa4d5704b54a23fe3072 Mon Sep 17 00:00:00 2001 From: enjolys Date: Fri, 2 Dec 2022 14:01:18 +0100 Subject: [PATCH] =?UTF-8?q?delete=20des=20ancienne=20donn=C3=A9=20(fetchda?= =?UTF-8?q?ta)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjetBlazor/Data/WeatherForecast.cs | 13 ------ ProjetBlazor/Data/WeatherForecastService.cs | 20 --------- ProjetBlazor/Pages/FetchData.razor | 48 --------------------- ProjetBlazor/Program.cs | 2 - ProjetBlazor/Shared/NavMenu.razor | 5 --- 5 files changed, 88 deletions(-) delete mode 100644 ProjetBlazor/Data/WeatherForecast.cs delete mode 100644 ProjetBlazor/Data/WeatherForecastService.cs delete mode 100644 ProjetBlazor/Pages/FetchData.razor diff --git a/ProjetBlazor/Data/WeatherForecast.cs b/ProjetBlazor/Data/WeatherForecast.cs deleted file mode 100644 index 2e6399d..0000000 --- a/ProjetBlazor/Data/WeatherForecast.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace ProjetBlazor.Data -{ - public class WeatherForecast - { - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } - } -} \ No newline at end of file diff --git a/ProjetBlazor/Data/WeatherForecastService.cs b/ProjetBlazor/Data/WeatherForecastService.cs deleted file mode 100644 index eb423ab..0000000 --- a/ProjetBlazor/Data/WeatherForecastService.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace ProjetBlazor.Data -{ - public class WeatherForecastService - { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - public Task GetForecastAsync(DateTime startDate) - { - return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = startDate.AddDays(index), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }).ToArray()); - } - } -} \ No newline at end of file diff --git a/ProjetBlazor/Pages/FetchData.razor b/ProjetBlazor/Pages/FetchData.razor deleted file mode 100644 index b56c475..0000000 --- a/ProjetBlazor/Pages/FetchData.razor +++ /dev/null @@ -1,48 +0,0 @@ -@page "/fetchdata" - -Weather forecast - -@using ProjetBlazor.Data -@inject WeatherForecastService ForecastService - -

Weather forecast

- -

This component demonstrates fetching data from a service.

- -@if (forecasts == null) -{ -

Loading...

-} -else -{ - - - - - - - - - - - @foreach (var forecast in forecasts) - { - - - - - - - } - -
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
-} - -@code { - private WeatherForecast[]? forecasts; - - protected override async Task OnInitializedAsync() - { - forecasts = await ForecastService.GetForecastAsync(DateTime.Now); - } -} diff --git a/ProjetBlazor/Program.cs b/ProjetBlazor/Program.cs index e8af13d..d9bdc27 100644 --- a/ProjetBlazor/Program.cs +++ b/ProjetBlazor/Program.cs @@ -1,13 +1,11 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; -using ProjetBlazor.Data; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); -builder.Services.AddSingleton(); var app = builder.Build(); diff --git a/ProjetBlazor/Shared/NavMenu.razor b/ProjetBlazor/Shared/NavMenu.razor index 54ae56e..665b566 100644 --- a/ProjetBlazor/Shared/NavMenu.razor +++ b/ProjetBlazor/Shared/NavMenu.razor @@ -19,11 +19,6 @@ Counter -