Example #1
0
        public static List <ViewPageDataOnly> GetData(StackAppContext appContext, RequestQueryString requestQuery)
        {
            var baseEntity  = EntityMetaData.Get(requestQuery.EntityId);
            var baseField   = baseEntity.GetFieldSchema(requestQuery.FieldName);
            var childEntity = EntityMetaData.Get(baseField.RefObject);

            var ids   = FetchDataModel(appContext, requestQuery.ItemId, baseField, childEntity);
            var pages = new List <ViewPageDataOnly>();

            var lConext = new LayoutContext(appContext, 0, baseField.RefObject);

            lConext.Build();

            foreach (var id in ids)
            {
                var query = new RequestQueryString()
                {
                    EntityId = baseField.RefObject, ItemId = id
                };

                var context = new EditFormContext(appContext, baseField.RefObject, query);
                context.Build();
                context.CreateDataModel();

                context.LayoutContext = lConext;

                var renderer = new EditFormRenderer(context);
                renderer.Generate(lConext);

                pages.Add(renderer.GetViewPageOnlyData());
            }

            return(pages);
        }
        public EntityModelBase Generate(UIFormModel model)
        {
            this.ValidatrRequest();

            _formContext.CreateDataModel();

            RecordModel = _formContext.EntityModel;

            SetRelationShip();

            this.SetFieldsModelToRecord(model);
            Status = AnyStatus.Success;

            return(RecordModel);
        }
Example #3
0
        public ViewPage CreateEditPage(EditFormContext context)
        {
            if (!context.Context.UserInfo.HasAccess(context.Entity.EntityId, AccessType.Update))
            {
                throw new AuthException("Operation not allowed.");
            }

            context.CreateDataModel();
            var lConext = new LayoutContext(context.Context, context.ItemTypeId, context.Entity.EntityId);

            lConext.Build();
            context.LayoutContext = lConext;

            var renderer = new EditFormRenderer(context);

            renderer.Generate(lConext);

            return(renderer.GetViewPage());
        }