public ActionResult Index() { DataSelectionViewModel currentViewModel = TempData[TempDataModelKey] as DataSelectionViewModel ?? new DataSelectionViewModel(); if (!currentViewModel.Contexts.Any()) { foreach (var item in eavClient.LoadContexts()) { currentViewModel.Contexts.Add(item); } } TempData[TempDataModelKey] = currentViewModel; return(View("Index", currentViewModel)); }
public ActionResult Index() { MetadataModel metadata = new MetadataModel(); // Add any existing contexts foreach (var item in eavClient.LoadContexts()) { metadata.Contexts.Add(item); } // Force validation so that UI lights up TryValidateModel(metadata); TempData["Metadata"] = metadata; return(View("Index", metadata)); }