public IActionResult EditSystemView(long id) { var model = _monitor.GetSystemForEdit(id, GetCurrentUserAsync().Result.UserName); if (model == null) { _toastNotification.AddErrorToastMessage("System does not exist", new ToastrOptions() { PositionClass = ToastPositions.TopCenter }); return(RedirectToAction("ListSystem")); } var vendorList = _monitor.VendorSelectList(model.VendorId); if (vendorList == null) { _toastNotification.AddErrorToastMessage("Vendor does not exist", new ToastrOptions() { PositionClass = ToastPositions.TopCenter }); return(RedirectToAction("ListSystem")); } var configurationTypeList = _monitor.ConfigurationTypeSelectList(model.ConfigTypeId); if (configurationTypeList == null) { _toastNotification.AddErrorToastMessage("Configuration type does not exit", new ToastrOptions() { PositionClass = ToastPositions.TopCenter }); return(RedirectToAction("ListSystem")); } //ViewBag.VendorList = _monitor.VendorSelectList(model.VendorId); ViewBag.ConfigList = from c in _monitor.GetConfigurationByVendor(model.VendorId) select new { ConfigId = c.Id, ConfigName = c.Name }; ViewBag.VendorList = from v in _monitor.VendorSelectList(model.VendorId) select new { VendorId = v.Id, VendorName = v.Name }; ViewBag.EnvironmentList = _monitor.EnvironmentSelectList(model.EnvironmentId); return(View(model)); }