You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 line
765B

  1. using Microsoft.AspNetCore.Mvc;
  2. namespace Campaign_Tracker.Server.Controllers;
  3. [ApiController]
  4. [Route("[controller]")]
  5. public class WeatherForecastController : ControllerBase
  6. {
  7. private static readonly string[] Summaries =
  8. [
  9. "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
  10. ];
  11. [HttpGet(Name = "GetWeatherForecast")]
  12. public IEnumerable<WeatherForecast> Get()
  13. {
  14. return Enumerable.Range(1, 5).Select(index => new WeatherForecast
  15. {
  16. Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
  17. TemperatureC = Random.Shared.Next(-20, 55),
  18. Summary = Summaries[Random.Shared.Next(Summaries.Length)]
  19. })
  20. .ToArray();
  21. }
  22. }

Powered by TurnKey Linux.