예제 #1
0
        public async Task <IActionResult> Export(int projectId, bool jsonExport = true)
        {
            EditorViewModel model = EditorBL.EditorData(_context, projectId, $"{_env.WebRootPath}");

            model.Mode = EditorMode.Export;

            if (model.ProjectData == null)
            {
                return(RedirectToAction("Index", "Projects"));
            }

            string redirect = "";

            if (jsonExport)
            {
                redirect = EditorBL.ExportProjectJson(_context, projectId, $"{_env.WebRootPath}");
            }
            else
            {
                string htmlContent = await RenderPartialViewToString("Preview", model);

                redirect = EditorBL.ExportProjectHtml(projectId, $"{_env.WebRootPath}", htmlContent, model.EditorData.CustomCss);
            }

            ProjectsBL.SetProjectStatus(_context, projectId, Models.Enums.ProjectStatus.Exported, true);

            return(RedirectToAction("Index", "Projects", new { RedirectTo = redirect }));
        }
예제 #2
0
        public IActionResult Index(int projectId)
        {
            EditorViewModel editor = EditorBL.EditorData(_context, projectId, $"{_env.WebRootPath}");

            if (editor.ProjectData == null)
            {
                return(RedirectToAction("Index", "Projects"));
            }
            ProjectsBL.SetProjectStatus(_context, projectId, Models.Enums.ProjectStatus.Editable);
            return(View(editor));
        }