Esempio n. 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 }));
        }
Esempio n. 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));
        }
Esempio n. 3
0
        public IActionResult Preview(int projectId)
        {
            ViewBag.IsClientPreview = true;
            EditorViewModel editor = EditorBL.EditorData(_context, projectId, $"{_env.WebRootPath}");

            editor.Mode = EditorMode.Preview;
            if (editor.ProjectData == null)
            {
                return(RedirectToAction("Index", "Projects"));
            }

            return(View(editor));
        }