public ActionResult Settings()
        {
            int id = Int32.Parse(Request.Form["Id"]);
            Node node = mySensorsDb.GetNode(id);
            string nodename = Request.Form["nodename"];
            if (nodename == "")
                nodename = null;
            node.name = nodename;
            foreach (var sensor in node.sensors)
            {

                string sensordescription = Request.Form["sensordescription-" + sensor.sensorId];
                if (sensordescription == "")
                    sensordescription = null;
                sensor.description = sensordescription;

            }
            mySensorsDb.UpdateNode(node);

            GatewayAPIController gatewayApi = new GatewayAPIController();
            gatewayApi.UpdateNodeSettings(node);


            return RedirectToAction("Index");
            // return View(node);
        }
예제 #2
0
        public ActionResult Settings()
        {
            int    id       = Int32.Parse(Request.Form["Id"]);
            Node   node     = mySensorsDb.GetNode(id);
            string nodename = Request.Form["nodename"];

            if (nodename == "")
            {
                nodename = null;
            }
            node.name = nodename;
            foreach (var sensor in node.sensors)
            {
                string sensordescription = Request.Form["sensordescription-" + sensor.sensorId];
                if (sensordescription == "")
                {
                    sensordescription = null;
                }
                sensor.description = sensordescription;
            }
            mySensorsDb.UpdateNode(node);

            GatewayAPIController gatewayApi = new GatewayAPIController();

            gatewayApi.UpdateNodeSettings(node);


            return(RedirectToAction("Index"));
            // return View(node);
        }
예제 #3
0
        public ActionResult Remove(int id)
        {
            Node node = mySensorsDb.GetNode(id);

            if (node == null)
            {
                return(HttpNotFound());
            }


            GatewayAPIController gatewayApi = new GatewayAPIController();

            gatewayApi.RemoveNode(node.Id);

            mySensorsDb.RemoveNode(node.Id);


            return(RedirectToAction("Index"));
        }
        public ActionResult Remove(int id)
        {
            Node node = mySensorsDb.GetNode(id);
            if (node == null)
                return HttpNotFound();


            GatewayAPIController gatewayApi = new GatewayAPIController();
            gatewayApi.RemoveNode(node.Id);

            mySensorsDb.RemoveNode(node.Id);


            return RedirectToAction("Index");
        }