コード例 #1
0
 public ActionResult NewTemplatePage(string pageName, string template, string saveAsDraft)
 {
     if (_signInManager.IsSignedIn(User))
     {
         SqlAccess.SqlAccess sa = new SqlAccess.SqlAccess();
         string newPageName     = ((saveAsDraft == "true") ? "Draft|" : "") + pageName;
         // Create the new page
         DataSet selectedTemplate = sa.GetTemplateByName(template);
         DataRow dR = selectedTemplate.Tables[0].Rows[0];
         sa.NewPage(newPageName, dR["contents_html"].ToString(), dR["contents_css"].ToString(), dR["contents_js"].ToString(), dR["contents_head"].ToString());
         // Send to the page
         return(RedirectToAction("EditPage", new { id = newPageName }));
     }
     else
     {
         return(RedirectToAction("ViewPage", "Page"));
     }
 }
コード例 #2
0
 public ActionResult EditPageForm(string pageName, string HtmlEdit, string CssEdit, string JsEdit, string HeadEdit, string saveAsDraft)
 {
     if (_signInManager.IsSignedIn(User))
     {
         SqlAccess.SqlAccess sa = new SqlAccess.SqlAccess();
         string newPageName     = pageName;
         if (saveAsDraft == "Yes")
         {
             newPageName = "Draft|" + pageName;
         }
         else if (saveAsDraft == "Undraft")
         {
             newPageName = pageName.Substring(6);
             sa.DeletePage(pageName);
         }
         sa.NewPage(newPageName, HtmlEdit, CssEdit, JsEdit, HeadEdit);
         return(RedirectToAction("ViewPage", new { id = newPageName }));
     }
     else
     {
         return(RedirectToAction("ViewPage", "Page"));
     }
 }