Beispiel #1
0
        public virtual ActionResult AddSystemTemplate(string c, string v, string t)
        {
            if (string.IsNullOrEmpty(c) || string.IsNullOrEmpty(v))
            {
                return(Content("Error"));
            }
            if (!c.Contains("<%@"))
            {
                c = "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" Inherits=\"System.Web.Mvc.ViewUserControl\" %>" + c;
            }
            var li = new SelectListItem
            {
                Text  = t,
                Value = v
            };
            var x = ConfigSerializer.Load <List <SelectListItem> >("SystemTemplate");

            if (x.Where(q => q.Value == li.Value).Count() != 1)
            {
                x.Add(li);
                ConfigSerializer.Save(x, "SystemTemplate");
                ConfigSerializer.ClearCache("SystemTemplate");
                //	CHSNS.File.SaveAllText(Path.EventSystemTemplatePath(li.Value), c);
            }
            else
            {
                return(Content("Error"));
            }
            return(Content("添加成功"));
        }