diff options
| author | Zach Berwaldt <zberwaldt@tutamail.com> | 2024-08-20 19:27:34 -0400 |
|---|---|---|
| committer | Zach Berwaldt <zberwaldt@tutamail.com> | 2024-08-20 19:27:34 -0400 |
| commit | 135a9e75e180f3276cceb4e37415f84906e66016 (patch) | |
| tree | d697f33f5877451d25fa380a84b917536632e844 /PersonalApi/Controllers | |
| parent | 7bed94e1589c182dce32c3e277ac07ccf44bfd8f (diff) | |
Diffstat (limited to 'PersonalApi/Controllers')
| -rw-r--r-- | PersonalApi/Controllers/ActivityController.cs | 11 | ||||
| -rw-r--r-- | PersonalApi/Controllers/WeatherForecastController.cs | 34 |
2 files changed, 45 insertions, 0 deletions
diff --git a/PersonalApi/Controllers/ActivityController.cs b/PersonalApi/Controllers/ActivityController.cs new file mode 100644 index 0000000..73371da --- /dev/null +++ b/PersonalApi/Controllers/ActivityController.cs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | using Microsoft.AspNetCore.Http; | ||
| 2 | using Microsoft.AspNetCore.Mvc; | ||
| 3 | |||
| 4 | namespace PersonalApi.Controllers | ||
| 5 | { | ||
| 6 | [Route("[controller]")] | ||
| 7 | [ApiController] | ||
| 8 | public class ActivityController : ControllerBase | ||
| 9 | { | ||
| 10 | } | ||
| 11 | } | ||
diff --git a/PersonalApi/Controllers/WeatherForecastController.cs b/PersonalApi/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..161a12a --- /dev/null +++ b/PersonalApi/Controllers/WeatherForecastController.cs | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | using Microsoft.AspNetCore.Mvc; | ||
| 2 | using PersonalApi.Models; | ||
| 3 | |||
| 4 | namespace PersonalApi.Controllers | ||
| 5 | { | ||
| 6 | [ApiController] | ||
| 7 | [Route("[controller]")] | ||
| 8 | public class WeatherForecastController : ControllerBase | ||
| 9 | { | ||
| 10 | private static readonly string[] Summaries = new[] | ||
| 11 | { | ||
| 12 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" | ||
| 13 | }; | ||
| 14 | |||
| 15 | private readonly ILogger<WeatherForecastController> _logger; | ||
| 16 | |||
| 17 | public WeatherForecastController(ILogger<WeatherForecastController> logger) | ||
| 18 | { | ||
| 19 | _logger = logger; | ||
| 20 | } | ||
| 21 | |||
| 22 | [HttpGet(Name = "GetWeatherForecast")] | ||
| 23 | public IEnumerable<WeatherForecast> Get() | ||
| 24 | { | ||
| 25 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast | ||
| 26 | { | ||
| 27 | Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), | ||
| 28 | TemperatureC = Random.Shared.Next(-20, 55), | ||
| 29 | Summary = Summaries[Random.Shared.Next(Summaries.Length)] | ||
| 30 | }) | ||
| 31 | .ToArray(); | ||
| 32 | } | ||
| 33 | } | ||
| 34 | } | ||
