Beispiel #1
0
        public JsonResult GetConfig(string name)
        {
            var template     = ExpressApplication.GetExpress(name);
            var elementTypes = Enum.GetValues(typeof(ExpressElementType));
            var allElements  = new List <Element>();

            foreach (var item in elementTypes)
            {
                Element el = new Element()
                {
                    key   = ((int)item).ToString(),
                    value = ((ExpressElementType)item).ToDescription()
                };
                allElements.Add(el);
            }
            ExpressTemplateConfig config = new ExpressTemplateConfig()
            {
                width  = template.Width,
                height = template.Height,
                data   = allElements.ToArray(),
            };

            if (template.Elements != null)
            {
                int i = 0;
                foreach (var element in template.Elements)
                {
                    var item = config.data.FirstOrDefault(t => t.key == ((int)element.ElementType).ToString());
                    item.a        = element.a;
                    item.b        = element.b;
                    item.selected = true;
                    i++;
                }
                config.selectedCount = i;
            }
            return(Json(config));
        }
Beispiel #2
0
        public ActionResult Edit(string name)
        {
            var template = ExpressApplication.GetExpress(name);

            return(View(template));
        }