Esempio n. 1
0
 public ActionResult Setting()
 {
     var model = new CategorySettingsModel();
     var setting = _settingService.Find((int)SettingType.CategorySetting);
     if (setting != null)
     {
         model = SerializationUtility.DeserializeFromXml<CategorySettingsModel>(setting.Values);
     }
     return View(model);
 }
Esempio n. 2
0
        public string EditSetting(CategorySettingsModel settingModel)
        {
            if (ModelState.IsValid)
            {
                var setting = _settingService.Find(settingModel.Id);
                if (setting != null)
                {
                    setting.Values = SerializationUtility.SerializeAsXml(settingModel);
                    _settingService.Update(setting);
                    _unitOfWork.SaveChanges();

                    return JsonConvert.SerializeObject(new { Status = 1, Message = "Update success." });
                }
                return JsonConvert.SerializeObject(new { Status = 0, Message = "Update unsuccess." });
            }
            return JsonConvert.SerializeObject(new { Status = 0, Message = "Update unsuccess." });
        }