コード例 #1
0
        public ActionResult WriteTemplate(string appName, string json, bool setValues = false)
        {
            try
            {
                object rehydrated = JsonConvert.DeserializeObject(json);

                string   name = GetName((JObject)rehydrated);
                string   path = Server.MapPath("~/bam/apps/{0}/dust/{1}.dust"._Format(appName, name));
                string   html = HtmlHelperExtensions.FieldsetFor(null, rehydrated, name, null, setValues).ToString().XmlToHumanReadable();
                FileInfo file = new System.IO.FileInfo(path);
                int      i    = 1;
                while (System.IO.File.Exists(path))
                {
                    path = Path.Combine(file.Directory.FullName, "{0}_{1}.dust"._Format(Path.GetFileNameWithoutExtension(file.Name), i));
                    i++;
                }
                html.SafeWriteToFile(path);
                return(Json(new { Success = true }));
            }
            catch (Exception ex)
            {
                return(Json(new { Success = false, Message = ex.Message }));
            }
        }
コード例 #2
0
        public override void ExecuteResult(ControllerContext context)
        {
            HttpResponseBase response = context.HttpContext.Response;

            response.Write(HtmlHelperExtensions.FieldsetFor(null, Data, Legend));
        }
コード例 #3
0
 protected internal static MvcHtmlString FieldSetFor(dynamic obj, string legendText, object wrapperAttrs = null, bool setValues = false)
 {
     return(HtmlHelperExtensions.FieldsetFor(null, obj, legendText, wrapperAttrs, setValues));
 }