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 ViewPage CreateDetailPage(DetailFormContext context) { if (!context.Context.UserInfo.HasAccess(context.Entity.EntityId, AccessType.Read)) { 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 DetailFormRenderer(context); renderer.Generate(lConext); return(renderer.GetViewPage()); }