//constructor to initialize network components public CreateController(PeopleContext context) { createDM = new CreateDataManager(context); this._context = context; //this.newHost = new Host(); //this.newSwitch = new Switch(); //this.newNetwork = new Network(); //SaveNetwork(_context, newNetwork); }
public IActionResult AddNewSwitch([FromBody] PostedSwitch switch1) { this.newSwitch = new Switch(); this.newSwitch.Name = switch1.name; this.newSwitch.Adapter = switch1.eth0; this.newSwitch.ports = switch1.ports; this.newSwitch.NetworkID = _context.getNetworkId(NetworkName); CreateDataManager.SaveSwitch(_context, this.newSwitch); return(RedirectToAction("Index")); }
public IActionResult AddNewHost([FromBody] PostedHost host) { this.newHost = new Host(); this.newHost.Name = host.name; this.newHost.Adapter = host.eth0; newHost.SwitchID = _context.getSwitchID(host.switchName); this.newHost.NetworkID = _context.getNetworkId(NetworkName); CreateDataManager.SaveHost(_context, this.newHost); return(RedirectToAction("Index")); }