Пример #1
0
 public ActionResult Code(string name, string type, string code, string locale)
 {
     var form = _GetForm(name, type);
     var bodyTmpl = new ContentTemplate()
     {
         ContentType = TemplateContentTypes.Razor,
         Text = code
     };
     form.BodyTemplateXml = bodyTmpl.Element().OuterXml();
     form.Save();
     TemplateHelper.SaveAsView(form.Parent, code, string.Format("_form_{0}_tmpl.cshtml", form.FormTypeString.ToLower()), true);
     return new HttpStatusCodeResult(200);
 }
Пример #2
0
        public ActionResult Code(string name, string type, string code, string locale)
        {
            var form     = _GetForm(name, type);
            var bodyTmpl = new ContentTemplate()
            {
                ContentType = TemplateContentTypes.Razor,
                Text        = code
            };

            form.BodyTemplateXml = bodyTmpl.Element().OuterXml();
            form.Save();
            TemplateHelper.SaveAsView(form.Parent, code, string.Format("_form_{0}_tmpl.cshtml", form.FormTypeString.ToLower()), true);
            return(new HttpStatusCodeResult(200));
        }
Пример #3
0
        public ActionResult Code(string name, string slug, string code, string locale)
        {
            var view     = Find(name, slug);
            var bodyTmpl = new ContentTemplate()
            {
                ContentType = TemplateContentTypes.Razor,
                Text        = code
            };

            view.BodyTemplateXml = bodyTmpl.Element().OuterXml();
            view.Save();
            TemplateHelper.SaveAsView(view.Parent, code, string.Format("_view_{0}_tmpl.cshtml", view.Name), true);
            return(new HttpStatusCodeResult(200));
        }
Пример #4
0
        public ActionResult SetStyle(string name, string slug, string style)
        {
            var view     = Find(name, slug);
            var tmplFile = "~/content/types/base/views/" + style + (style.EndsWith(".cshtml", StringComparison.OrdinalIgnoreCase) ? "" : ".cshtml");

            if (!System.IO.File.Exists(Server.MapPath(tmplFile)))
            {
                throw new HttpException("View template file not found.");
            }

            var bodyTmpl = new ContentTemplate()
            {
                ContentType = TemplateContentTypes.Razor,
                Source      = style + (style.EndsWith(".cshtml", StringComparison.OrdinalIgnoreCase) ? "" : ".cshtml")
            };

            view.BodyTemplateXml = bodyTmpl.Element().OuterXml();
            view.Save();

            return(new HttpStatusCodeResult(200));
        }
Пример #5
0
 public ActionResult Code(string name, string slug, string code, string locale)
 {
     var view = Find(name, slug);
     var bodyTmpl = new ContentTemplate()
     {
         ContentType = TemplateContentTypes.Razor,
         Text = code
     };
     view.BodyTemplateXml = bodyTmpl.Element().OuterXml();
     view.Save();
     TemplateHelper.SaveAsView(view.Parent, code, string.Format("_view_{0}_tmpl.cshtml", view.Name), true);
     return new HttpStatusCodeResult(200);
 }
Пример #6
0
        public ActionResult SetStyle(string name, string slug, string style)
        {
            var view = Find(name, slug);
            var tmplFile = "~/content/types/base/views/" + style + (style.EndsWith(".cshtml", StringComparison.OrdinalIgnoreCase) ? "" : ".cshtml");
            if (!System.IO.File.Exists(Server.MapPath(tmplFile)))
                throw new HttpException("View template file not found.");

            var bodyTmpl = new ContentTemplate()
            {
                ContentType = TemplateContentTypes.Razor,
                Source = style + (style.EndsWith(".cshtml", StringComparison.OrdinalIgnoreCase) ? "" : ".cshtml")
            };
            view.BodyTemplateXml = bodyTmpl.Element().OuterXml();
            view.Save();

            return new HttpStatusCodeResult(200);
        }