示例#1
0
        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"));
        }
示例#2
0
        public IActionResult EthernetGateway()
        {
            EthernetGatewayViewModel model = new EthernetGatewayViewModel
            {
                Ip   = SystemController.gatewayConfig.EthernetGateway.GatewayIP,
                Port = SystemController.gatewayConfig.EthernetGateway.GatewayPort
            };

            return(View(model));
        }
示例#3
0
        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.EthernetGateway.GatewayIP   = model.Ip;
            SystemController.gatewayConfig.EthernetGateway.GatewayPort = model.Port;

            return(RedirectToAction("Index"));
        }