public IActionResult EthernetGateway(EthernetGatewayViewModel model) { dynamic json = ReadConfig(); json.Gateway.EthernetGateway.GatewayIP = model.Ip; json.Gateway.EthernetGateway.GatewayPort = model.Port; WriteConfig(json); configuration.Reload(); SystemController.DisconnectGateway(); SystemController.gatewayConfig.EthernetGatewayConfig.GatewayIP = model.Ip; SystemController.gatewayConfig.EthernetGatewayConfig.GatewayPort = model.Port; return RedirectToAction("Index"); }
public IActionResult EthernetGateway() { EthernetGatewayViewModel model = new EthernetGatewayViewModel { Ip = SystemController.gatewayConfig.EthernetGatewayConfig.GatewayIP, Port = SystemController.gatewayConfig.EthernetGatewayConfig.GatewayPort }; return View(model); }
public IActionResult GatewayEthernet(EthernetGatewayViewModel model) { //prevent start wizard if already passed if (!bool.Parse(configuration["FirstRun"])) return View("Error", ALREADY_PASSED_MESSAGE); //redirect to first step if user came this url directly if (SystemController.dataBaseConfig == null) return RedirectToAction("Index"); dynamic json = ReadConfig(); json.Gateway.EthernetGateway.GatewayIP = model.Ip; json.Gateway.EthernetGateway.GatewayPort = model.Port; json.Gateway.SerialGateway.Enable = false; json.Gateway.EthernetGateway.Enable = true; WriteConfig(json); configuration.Reload(); SystemController.DisconnectGateway(); SystemController.ReadConfig(); SystemController.ConnectToGateway(); return RedirectToAction("UserProfile"); }