Esempio n. 1
0
        public virtual IHtmlString RenderModule(string moduleName, string moduleUrl, ModulePosition modulePosition)
        {
            var result = ModuleExecutor.InvokeAction(PageContext.ControllerContext, PageContext.PageRequestContext.Site, moduleUrl, modulePosition);
            var actionResultExecuted = ModuleExecutor.ExecuteActionResult(result);

            return(new HtmlString(actionResultExecuted.ResultHtml));
        }
Esempio n. 2
0
        public virtual bool ExecuteModuleControllerAction()
        {
            var modulePositions = PageRequestContext.Page.AsActual().PagePositions.Where(it => it is ModulePosition).OrderBy(it => it.Order);
            IDictionary <string, ModuleActionInvokedContext> moduleActionResults = new Dictionary <string, ModuleActionInvokedContext>();

            foreach (ModulePosition modulePosition in modulePositions)
            {
                var site      = Page_Context.Current.PageRequestContext.Site;
                var moduleUrl = Page_Context.Current.PageRequestContext.ModuleUrlContext.GetModuleUrl(modulePosition.PagePositionId);

                ModuleActionInvokedContext result = ModuleExecutor.InvokeAction(this.ControllerContext, site, moduleUrl, modulePosition);
                if (result != null)
                {
                    if (ModuleActionResultExecutor.IsExclusiveResult(result.ActionResult))
                    {
                        ModuleActionResultExecutor.ExecuteExclusiveResult(result.ControllerContext, result.ActionResult);
                        return(false);
                    }
                    moduleActionResults.Add(modulePosition.PagePositionId, result);
                }
            }

            ModuleResults = moduleActionResults;
            return(true);
        }
Esempio n. 3
0
        protected virtual string RenderModule(ModulePosition modulePosition)
        {
            ModuleActionInvokedContext actionInvokedContext = GetModuleActionResult(modulePosition.PagePositionId);

            if (actionInvokedContext != null)
            {
                var actionResultExecuted = ModuleExecutor.ExecuteActionResult(actionInvokedContext);
                return(actionResultExecuted.ResultHtml);
            }
            return(string.Empty);
        }
Esempio n. 4
0
        public virtual ActionResult Scaffold(string moduleName, string moduleUrl)
        {
            ModuleAdminPosition position = new ModuleAdminPosition()
            {
                ModuleName = moduleName
            };

            if (string.IsNullOrEmpty(moduleUrl))
            {
                moduleUrl = "~/admin";
            }
            var moduleActionResult = ModuleExecutor.InvokeAction(this.ControllerContext, Site, moduleUrl, position);

            if (ModuleActionResultExecutor.IsExclusiveResult(moduleActionResult.ActionResult))
            {
                return(moduleActionResult.ActionResult);
            }
            else
            {
                var moduleHtml = ModuleExecutor.ExecuteActionResult(moduleActionResult);
                return(View(moduleHtml));
            }
        }