Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[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