From ccf47dc88ab0a8aa512a91d15af2502ecab8a31c Mon Sep 17 00:00:00 2001 From: Rodion Mostovoi <36400912+rodion-m@users.noreply.github.com> Date: Sun, 5 Mar 2023 11:44:21 +0600 Subject: [PATCH] Fix datetime parsing exception in WeatherForecast When datetime delimiter is `-` instead of `/` the endpoint was crashing with FormatException. --- GhostUI/Models/WeatherForecast.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GhostUI/Models/WeatherForecast.cs b/GhostUI/Models/WeatherForecast.cs index 9dbaad3..0fd1fbb 100644 --- a/GhostUI/Models/WeatherForecast.cs +++ b/GhostUI/Models/WeatherForecast.cs @@ -10,6 +10,6 @@ public class WeatherForecast : IWeatherForecast public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - public int Id => Convert.ToInt32(DateFormatted?.Replace("/", "")); + public int Id => Random.Shared.Next(0, 1000); } }