Jobs, Jobs, Jobs
@@ -82,4 +83,9 @@
{
collapseNavMenu = !collapseNavMenu;
}
+
+ public void Dispose()
+ {
+ state.OnChange -= StateHasChanged;
+ }
}
\ No newline at end of file
diff --git a/src/JobsJobsJobs/Server/Controllers/WeatherForecastController.cs b/src/JobsJobsJobs/Server/Controllers/WeatherForecastController.cs
deleted file mode 100644
index 7411183..0000000
--- a/src/JobsJobsJobs/Server/Controllers/WeatherForecastController.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using JobsJobsJobs.Shared;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace JobsJobsJobs.Server.Controllers
-{
- [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/src/JobsJobsJobs/Server/JobsJobsJobs.Server.csproj b/src/JobsJobsJobs/Server/JobsJobsJobs.Server.csproj
index dd6057c..edad51e 100644
--- a/src/JobsJobsJobs/Server/JobsJobsJobs.Server.csproj
+++ b/src/JobsJobsJobs/Server/JobsJobsJobs.Server.csproj
@@ -8,6 +8,7 @@
+
@@ -18,5 +19,9 @@
+
+
+
+
diff --git a/src/JobsJobsJobs/Server/Startup.cs b/src/JobsJobsJobs/Server/Startup.cs
index 5c8018d..dda0659 100644
--- a/src/JobsJobsJobs/Server/Startup.cs
+++ b/src/JobsJobsJobs/Server/Startup.cs
@@ -8,6 +8,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
using NodaTime;
+using NodaTime.Serialization.SystemTextJson;
using Npgsql;
using System.Text;
@@ -26,11 +27,14 @@ namespace JobsJobsJobs.Server
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
+ // TODO: configure JSON serialization for NodaTime
services.AddScoped(_ => new NpgsqlConnection(Configuration.GetConnectionString("JobsDb")));
services.AddSingleton(SystemClock.Instance);
services.AddLogging();
services.AddControllersWithViews();
- services.AddRazorPages();
+ services.AddRazorPages()
+ .AddJsonOptions(options =>
+ options.JsonSerializerOptions.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb));
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
diff --git a/src/JobsJobsJobs/Shared/JobsJobsJobs.Shared.csproj b/src/JobsJobsJobs/Shared/JobsJobsJobs.Shared.csproj
index 84ed6e0..a27a8db 100644
--- a/src/JobsJobsJobs/Shared/JobsJobsJobs.Shared.csproj
+++ b/src/JobsJobsJobs/Shared/JobsJobsJobs.Shared.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/src/JobsJobsJobs/Shared/WeatherForecast.cs b/src/JobsJobsJobs/Shared/WeatherForecast.cs
deleted file mode 100644
index 2294174..0000000
--- a/src/JobsJobsJobs/Shared/WeatherForecast.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace JobsJobsJobs.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);
- }
-}