Example #1
0
        public ActionResult Create(SettingModel model)
        {
            if (ModelState.IsValid)
            {
                model.Name = model.Name.Trim();
                model.Value = model.Value.Trim();

                settingService.Set(model.Name, model.Value);
                return Json(new { IsValid = true});
            }

            //If we got this far, something failed, redisplay form
            return Json(new { IsValid = false, htmlData = RenderPartialViewToString("_CreateUpdate", model) });
        }
Example #2
0
        public ActionResult Create(Guid rowId)
        {
            var model = new SettingModel()
            {
                RowId = rowId
            };

            if (!rowId.IsEmpty())
            {
                var setting = settingService.GetById(rowId);
                if (setting != null)
                {
                    model.Name = setting.Name;
                    model.Value = setting.Value;
                    model.IsEdit = true;
                }
            }

            return PartialView("_CreateUpdate", model);
        }