Пример #1
0
 public JsonResult updatekey(Entity.DictionaryKeyInfo info)
 {
     using (var manage = new Data.CMSManage())
     {
         manage.updateDictionaryKey(info);
         return(getResult(manage.Error, manage.Message));
     }
 }
Пример #2
0
        /// <summary>
        /// 更新字典key
        /// </summary>
        /// <param name="info"></param>
        public bool updateDictionaryKey(Entity.DictionaryKeyInfo info)
        {
            var updateInfo = this.dbContext.DictionaryKey.Find(info.KeyId);

            if (info.DictionaryId > 0)
            {
                var dictionaryInfo = this.getDictionaryInfo(info.DictionaryId);
                if (dictionaryInfo != null)
                {
                    info.DictionaryCode = dictionaryInfo.DictionaryCode;
                }
            }

            if (updateInfo == null)
            {
                this.dbContext.DictionaryKey.Add(info);
            }
            else
            {
                this.dbContext.Entry <Entity.DictionaryKeyInfo>(updateInfo).CurrentValues.SetValues(info);
            }
            return(this.dbContext.SaveChanges() > 0);
        }