示例#1
0
        public ActionResult SelectContext(int contextID)
        {
            DataSelectionViewModel currentViewModel = TempData[TempDataModelKey] as DataSelectionViewModel;

            currentViewModel.SelectedContextID = contextID;

            IEnumerable <object> containers = Enumerable.Empty <object>();
            IEnumerable <object> subjects   = Enumerable.Empty <object>();

            if (currentViewModel.CurrentContext != null)
            {
                eavClient.LoadRootContainers(currentViewModel.CurrentContext);
                containers = currentViewModel.CurrentContext.Containers.Select(it => new { Text = it.Name, Value = it.ContainerID });

                eavClient.LoadSubjects(currentViewModel.CurrentContext);
                subjects = currentViewModel.CurrentContext.Subjects.Select(it => new { Text = it.Identifier, Value = it.SubjectID });
            }

            TempData[TempDataModelKey] = currentViewModel;

            return(new JsonResult()
            {
                Data = new { Containers = containers, Subjects = subjects }, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
示例#2
0
        public ActionResult EditContext(MetadataModel postedModel)
        {
            MetadataModel metadata = TempData["Metadata"] as MetadataModel;

            metadata.SelectedContextID = postedModel.SelectedContextID;

            IModelContext eavContext = metadata.CurrentContext;

            // TODO: Check state after loading containers, verify that Modified doesn't go away if set
            if (eavContext.ObjectState != ObjectState.Deleted && eavContext.ObjectState != ObjectState.New && !eavContext.Containers.Any())
            {
                eavClient.LoadRootContainers(eavContext);
            }

            metadata.DialogStack.Push(new ContextViewModel(eavContext)
            {
                Existing = true
            });

            TempData["Metadata"] = metadata;

            return(BuildResult("Context Editor", Url.Content("~/Metadata/ContextEditorDialog"), Url.Content("~/Metadata/UpdateContext"), null));
        }