Exemple #1
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public JsonResult Update(DataDictionary entity)
 {
     ModelState.Remove("CreatedTime");
     ModelState.Remove("UpdatedTime");
     ModelState.Remove("IsDelete");
     if (ModelState.IsValid)
     {
         var model = IDataDictionaryService.Find(entity.ID);
         if (model == null || (model != null && model.IsDelete))
         {
             return(DataErorrJResult());
         }
         if (IDataDictionaryService.IsExits(x => x.Key == entity.Key && x.ID != entity.ID))
         {
             return(JResult(Core.Code.ErrorCode.system_key_already_exist, ""));
         }
         model.Key    = entity.Key;
         model.Value  = entity.Value;
         model.Remark = entity.Remark;
         var result = IDataDictionaryService.Update(entity);
         if (result > 0)
         {
             CacheHelper.Clear();
         }
         return(JResult(result));
     }
     else
     {
         return(ParamsErrorJResult(ModelState));
     }
 }