diff --git a/NetworkResurrector.Agent/Controllers/ResurrectorAgentController.cs b/NetworkResurrector.Agent/Controllers/ResurrectorAgentController.cs new file mode 100644 index 0000000..c38b2b3 --- /dev/null +++ b/NetworkResurrector.Agent/Controllers/ResurrectorAgentController.cs @@ -0,0 +1,26 @@ +using MediatR; +using Microsoft.AspNetCore.Mvc; +using NetworkResurrector.Agent.Application.Queries; +using System.Threading.Tasks; + +namespace NetworkResurrector.Agent.Controllers +{ + [ApiController] + [Route("resurrector-agent")] + public class ResurrectorAgentController : ControllerBase + { + private readonly IMediator _mediator; + + public ResurrectorAgentController(IMediator mediator) + { + _mediator = mediator; + } + + [HttpGet("machines")] + public async Task GetMachines([FromRoute] GetMachines.Query query) + { + var result = await _mediator.Send(query); + return Ok(result); + } + } +} diff --git a/NetworkResurrector.Agent/Controllers/WeatherForecastController.cs b/NetworkResurrector.Agent/Controllers/WeatherForecastController.cs deleted file mode 100644 index 633d97c..0000000 --- a/NetworkResurrector.Agent/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace NetworkResurrector.Agent.Controllers -{ - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase - { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet] - public IEnumerable Get() - { - var rng = new Random(); - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = DateTime.Now.AddDays(index), - TemperatureC = rng.Next(-20, 55), - Summary = Summaries[rng.Next(Summaries.Length)] - }) - .ToArray(); - } - } -} diff --git a/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj b/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj index d12c450..20ada41 100644 --- a/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj +++ b/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj @@ -1,8 +1,29 @@ - + netcoreapp3.1 + + + + + + + + + + + + + + + + + + + + + diff --git a/NetworkResurrector.Agent/Properties/launchSettings.json b/NetworkResurrector.Agent/Properties/launchSettings.json index 4210700..6c62a80 100644 --- a/NetworkResurrector.Agent/Properties/launchSettings.json +++ b/NetworkResurrector.Agent/Properties/launchSettings.json @@ -1,26 +1,7 @@ { - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:52975", - "sslPort": 0 - } - }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "weatherforecast", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "NetworkResurrector.Agent": { "commandName": "Project", - "launchBrowser": true, - "launchUrl": "weatherforecast", "applicationUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/NetworkResurrector.Agent/WeatherForecast.cs b/NetworkResurrector.Agent/WeatherForecast.cs deleted file mode 100644 index 146091e..0000000 --- a/NetworkResurrector.Agent/WeatherForecast.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace NetworkResurrector.Agent -{ - public class WeatherForecast - { - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string Summary { get; set; } - } -} diff --git a/NetworkResurrector.Api/NetworkResurrector.Api.csproj b/NetworkResurrector.Api/NetworkResurrector.Api.csproj index 88d10f8..97fef7e 100644 --- a/NetworkResurrector.Api/NetworkResurrector.Api.csproj +++ b/NetworkResurrector.Api/NetworkResurrector.Api.csproj @@ -18,7 +18,6 @@ -