示例#1
0
        public ActionResult Index()
        {
            //db.settings.ToList()

            SettingModel setting_m = new SettingModel();

            setting_m.Sections = new Dictionary <string, string>();
            setting_m.Settings = new Dictionary <string, List <FormsModel> >();
            string section_active = "";

            foreach (var setting in db.settings.Where(w => w.is_gui == 1)
                     .ToList())
            {
                setting.module = setting.module == null || setting.module == "" ? "general" : setting.module;


                if (setting_m.Sections.ContainsKey(setting.module) == false)
                {
                    setting_m.Sections.Add(setting.module, SettingModel.GetTitle(setting.module));
                    setting_m.Settings.Add(setting.module, new List <FormsModel>());
                }
                //string form_control = FormsModel.BuildForm(setting);
                setting_m.Settings[setting.module].Add(new FormsModel {
                    slug = setting.slug, title = setting.title, description = setting.description, type = setting.type, value = setting.value, module = setting.module, options = setting.options
                });
            }
            //Response.Write(System.Web.Helpers.Json.Encode(setting_m.Settings));
            return(View(setting_m));
        }