From cbc80e71fac7d2896ac496b0fbf22051c0cdcff7 Mon Sep 17 00:00:00 2001 From: Avi Levkovich Date: Mon, 17 Feb 2020 17:00:29 +0200 Subject: merge --- .../Controllers/GatewayController.cs | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers') diff --git a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/GatewayController.cs b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/GatewayController.cs index 52036e46b..e3391cd5d 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/GatewayController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/GatewayController.cs @@ -4,15 +4,37 @@ using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; +using Tango.MachineService.Gateway.DB; +using Tango.MachineService.Gateway.DTO; +using Tango.MachineService.Gateway.Messages; +using Tango.Web.Controllers; namespace Tango.MachineService.Gateway.Controllers { - public class GatewayController : ApiController + public class GatewayController : TangoController { [HttpPost] - public String GetUrl() + public EnvironmentsResponse GetEnvironments(EnvironmentsRequest request) { - return "URL"; + EnvironmentsResponse response = new EnvironmentsResponse(); + + using (GatewayDbContext db = GatewayDbContext.CreateDefault()) + { + var envs = db.Environments.ToList(); + + foreach (var env in envs) + { + response.Environments.Add(new EnvironmentConfiguration() + { + ID = env.ID.ToString(), + Name = env.Name, + Description = env.Description, + MachineServiceAddress = env.MachineServiceAddress + }); + } + } + + return response; } } } -- cgit v1.3.1