From c8501298f705e8f96fa0d1798183af2fed7415a9 Mon Sep 17 00:00:00 2001 From: Neil Brommer Date: Mon, 29 Nov 2021 21:34:42 -0800 Subject: [PATCH] Remove default Blazor stuff --- Start/Client/Pages/Counter.razor | 16 ------ Start/Client/Pages/FetchData.razor | 56 ------------------- Start/Client/Pages/Index.razor | 8 --- Start/Client/Pages/StartPage.razor | 2 +- Start/Client/Shared/MainLayout.razor | 4 -- Start/Client/Shared/SurveyPrompt.razor | 16 ------ .../Controllers/WeatherForecastController.cs | 37 ------------ Start/Shared/WeatherForecast.cs | 15 ----- 8 files changed, 1 insertion(+), 153 deletions(-) delete mode 100644 Start/Client/Pages/Counter.razor delete mode 100644 Start/Client/Pages/FetchData.razor delete mode 100644 Start/Client/Pages/Index.razor delete mode 100644 Start/Client/Shared/SurveyPrompt.razor delete mode 100644 Start/Server/Controllers/WeatherForecastController.cs delete mode 100644 Start/Shared/WeatherForecast.cs diff --git a/Start/Client/Pages/Counter.razor b/Start/Client/Pages/Counter.razor deleted file mode 100644 index bd823e5..0000000 --- a/Start/Client/Pages/Counter.razor +++ /dev/null @@ -1,16 +0,0 @@ -@page "/counter" - -

Counter

- -

Current count: @currentCount

- - - -@code { - private int currentCount = 0; - - private void IncrementCount() - { - currentCount++; - } -} diff --git a/Start/Client/Pages/FetchData.razor b/Start/Client/Pages/FetchData.razor deleted file mode 100644 index 59c06ae..0000000 --- a/Start/Client/Pages/FetchData.razor +++ /dev/null @@ -1,56 +0,0 @@ -@page "/fetchdata" -@using Microsoft.AspNetCore.Authorization -@using Microsoft.AspNetCore.Components.WebAssembly.Authentication -@using Start.Shared -@attribute [Authorize] -@inject HttpClient Http - -

Weather forecast

- -

This component demonstrates fetching data from the server.

- -@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() - { - try - { - forecasts = await Http.GetFromJsonAsync("WeatherForecast"); - } - catch (AccessTokenNotAvailableException exception) - { - exception.Redirect(); - } - } - -} diff --git a/Start/Client/Pages/Index.razor b/Start/Client/Pages/Index.razor deleted file mode 100644 index b4b74c4..0000000 --- a/Start/Client/Pages/Index.razor +++ /dev/null @@ -1,8 +0,0 @@ -@page "/" - -

Hello, world!

- -Welcome to your new app. - - - diff --git a/Start/Client/Pages/StartPage.razor b/Start/Client/Pages/StartPage.razor index 5b4a167..3b0b3bf 100644 --- a/Start/Client/Pages/StartPage.razor +++ b/Start/Client/Pages/StartPage.razor @@ -1,4 +1,4 @@ -@page "/Start" +@page "/" @using System.Collections.Generic @using System.Linq @using Microsoft.AspNetCore.Components.WebAssembly.Authentication diff --git a/Start/Client/Shared/MainLayout.razor b/Start/Client/Shared/MainLayout.razor index 96db88a..36c932d 100644 --- a/Start/Client/Shared/MainLayout.razor +++ b/Start/Client/Shared/MainLayout.razor @@ -1,10 +1,6 @@ @inherits LayoutComponentBase
- -
diff --git a/Start/Client/Shared/SurveyPrompt.razor b/Start/Client/Shared/SurveyPrompt.razor deleted file mode 100644 index ffef1f7..0000000 --- a/Start/Client/Shared/SurveyPrompt.razor +++ /dev/null @@ -1,16 +0,0 @@ - - -@code { - // Demonstrates how a parent component can supply parameters - [Parameter] - public string? Title { get; set; } -} diff --git a/Start/Server/Controllers/WeatherForecastController.cs b/Start/Server/Controllers/WeatherForecastController.cs deleted file mode 100644 index 8d6242d..0000000 --- a/Start/Server/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using Start.Shared; - -namespace Start.Server.Controllers { - [Authorize] - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) { - _logger = logger; - } - - [HttpGet] - public IEnumerable Get() { - var rng = new Random(); - return Enumerable.Range(1, 5).Select(index => new WeatherForecast { - Date = DateTime.Now.AddDays(index), - TemperatureC = rng.Next(-20, 55), - Summary = Summaries[rng.Next(Summaries.Length)] - }) - .ToArray(); - } - } -} diff --git a/Start/Shared/WeatherForecast.cs b/Start/Shared/WeatherForecast.cs deleted file mode 100644 index dce0c00..0000000 --- a/Start/Shared/WeatherForecast.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Start.Shared { - public class WeatherForecast { - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public string? Summary { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - } -}