Пример #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
            });
        }