public ActionResult HardwareSettings() { var dto = HardwareSettingsService.GetSettings(); var model = new HardwareSettingsViewModel(); model.InjectFrom(dto); // Get the drives and drive information var drives = HardwareService.GetDrives().ToList(); var nics = HardwareService.GetAllNics(); model.Drives = new List <DriveSettingsViewModel>(); foreach (var d in drives) { var driveModel = new DriveSettingsViewModel(); driveModel.InjectFrom(d); model.Drives.Add(driveModel); } model.NicDict = new Dictionary <string, int>(); foreach (var nic in nics) { model.NicDict.Add(nic.Key, nic.Value); } // TODO: Add view return(View(model)); }
public ActionResult HardwareSettings() { var dto = HardwareSettingsService.GetSettings(); var model = Mapper.Map <HardwareSettingsViewModel>(dto); // Get the drives and drive information var drives = HardwareService.GetDrives().ToList(); var nics = HardwareService.GetAllNics(); model.Drives = new List <DriveSettingsViewModel>(); foreach (var d in drives) { var driveModel = new DriveSettingsViewModel(); driveModel.InjectFrom(d); model.Drives.Add(driveModel); } model.NetworkMonitoring.NicDict = new Dictionary <string, int>(); var ddlNics = new List <string>(); foreach (var nic in nics) { model.NetworkMonitoring.NicDict.Add(nic.Key, nic.Value); ddlNics.Add(nic.Key); } model.NetworkMonitoring.Nics = new SelectList(model.NetworkMonitoring.NicDict, "Value", "Key", 1); return(View(model)); }