Continous Integration in der Praxis Gruppenarbeit
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.

41 lines
1.2 KiB

2 years ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Mvc;
  6. using Microsoft.Extensions.Logging;
  7. using BlazorMiniGames.Shared;
  8. namespace BlazorMiniGames.Server.Controllers
  9. {
  10. [ApiController]
  11. [Route("[controller]")]
  12. public class WeatherForecastController : ControllerBase
  13. {
  14. private static readonly string[] Summaries = new[]
  15. {
  16. "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
  17. };
  18. private readonly ILogger<WeatherForecastController> _logger;
  19. public WeatherForecastController(ILogger<WeatherForecastController> logger)
  20. {
  21. _logger = logger;
  22. }
  23. [HttpGet]
  24. public IEnumerable<WeatherForecast> Get()
  25. {
  26. var rng = new Random();
  27. return Enumerable.Range(1, 5).Select(index => new WeatherForecast
  28. {
  29. Date = DateTime.Now.AddDays(index),
  30. TemperatureC = rng.Next(-20, 55),
  31. Summary = Summaries[rng.Next(Summaries.Length)]
  32. })
  33. .ToArray();
  34. }
  35. }
  36. }