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 })); }
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)); }
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)); }