Last active
July 19, 2022 18:36
-
-
Save ekaraman89/f9c78608838b0e3751f6dd01716a9225 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet(Name = "GetWeatherForecast")] | |
public IActionResult Get() | |
{ | |
try | |
{ | |
IEnumerable<WeatherForecast> list = Enumerable.Range(1, 5).Select(index => new WeatherForecast | |
{ | |
Date = DateTime.Now.AddDays(index), | |
TemperatureC = Random.Shared.Next(-20, 55), | |
Summary = Summaries[Random.Shared.Next(Summaries.Length)] | |
}) | |
.ToArray(); | |
if (list != null) | |
{ | |
throw new ApplicationException(); | |
} | |
return Ok(list); | |
} | |
catch (Exception ex) | |
{ | |
_logger.LogError(ex.Message); | |
return BadRequest(ex.Message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment