/// <summary> /// Action after "Update" button click /// </summary> /// <param name="viewModel">Interface options from form.</param> /// <returns>Redirect to home page</returns> public async Task <IActionResult> Edit(InterfaceViewModel viewModel) { if (viewModel.IsGVRP) { GVRPActivePortsSingleton.Instance.InterfaceStates[viewModel.Name] = InterfaceState.Listening; } else { GVRPActivePortsSingleton.Instance.InterfaceStates[viewModel.Name] = InterfaceState.Off; } switch (viewModel.Type) { case InterfaceType.Promiscuous when viewModel.VirtualLANs.Count() > 1: return(RedirectToAction("Index", new IndexViewModel { Error = "Promiscuous Interface cannot have more than 1 VLAN." })); case InterfaceType.Isolated when viewModel.VirtualLANs.Count() > 1: return(RedirectToAction("Index", new IndexViewModel { Error = "Isolated Interface cannot have more than 1 VLAN." })); } _ethernetServices.SetEthernetInterfaceState(viewModel.Name, viewModel.IsActive); _ethernetServices.ClearEthernetInterfaceVLANs(viewModel.Name); _ethernetServices.ApplyEthernetInterfaceVLANs(viewModel.Name, viewModel.Tagged, viewModel.IsGVRP, viewModel.VirtualLANs); _ethernetServices.SetEthernetInterfaceType(viewModel.Name, viewModel.Type); return(RedirectToAction("Index")); }
/// <summary> /// Action after "Update" button click /// </summary> /// <param name="viewModel">Interface options from form.</param> /// <returns>Redirect to home page</returns> public IActionResult Edit(InterfaceViewModel viewModel) { _ethernetServices.SetEthernetInterfaceState(viewModel.Name, viewModel.IsActive); _ethernetServices.ClearEthernetInterfaceVLANs(viewModel.Name); _ethernetServices.ApplyEthernetInterfaceVLANs(viewModel.Name, viewModel.Tagged, viewModel.VirtualLANs); _ethernetServices.SetEthernetInterfaceType(viewModel.Name, viewModel.Type); return(RedirectToAction("Index")); }