public JsonResult GetChildren(int type, int?childType, long parentId)
        {
            var context = new DataContext(true);

            ////var reposProps = new DataRepositoryProperties()
            //{
            //    NavigationProperties = (childType.HasValue ? _GetNavigationProperties((ModelType)type, new[] { (ModelType)childType }) : _GetNavigationProperties((ModelType)type))
            //};

            var dataSvc = new DataAccess(context);

            var parentModel = dataSvc.Get(type, parentId);

            parentModel.Children = new List <IModel>();

            var children = dataSvc.GetChildren(type, parentId);

            var vm = new TabContainerModel(children.Select(child => (IModel)_UpdateContainer(new TableContainerModel((IContainerModel)child))).ToList());

            if ((ModelType)type == ModelType.ReportElement)
            {
                vm.Children.Add(_CreateReportElementData(parentModel));
            }

            return(Json(vm, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public JsonResult GetChildren(int type, int?childType, long parentId)
        {
            var context = new DataContext(false);

            var reposProps = new DataRepositoryProperties()
            {
                NavigationProperties = (childType.HasValue ? _GetNavigationProperties((ModelType)type, new [] { (ModelType)childType }) : _GetNavigationProperties((ModelType)type))
            };

            var dataSvc = new DataAccess(context, reposProps);

            var children = dataSvc.GetChildren(type, parentId);

            var vm = new TabContainerModel(children.Select(child => (IModel)_UpdateContainer(new TableContainerModel((IContainerModel)child))).ToList());

            return(Json(vm, JsonRequestBehavior.AllowGet));
        }