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); }
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); }
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"); }