Exemple #1
0
 public JsonResult update(Entity.DictionaryInfo info)
 {
     using (var manage = new Data.CMSManage())
     {
         manage.updateDictionary(info);
         return(getResult(manage.Error, manage.Message));
     }
 }
Exemple #2
0
        /// <summary>
        /// 更新字典
        /// </summary>
        /// <param name="info"></param>
        public bool updateDictionary(Entity.DictionaryInfo info)
        {
            var updateInfo = this.getDictionaryInfo(info.DictionaryId);

            if (updateInfo == null)
            {
                this.dbContext.Dictionary.Add(info);
            }
            else
            {
                this.dbContext.Entry <Entity.DictionaryInfo>(updateInfo).CurrentValues.SetValues(info);
            }
            return(this.dbContext.SaveChanges() > 0);
        }
Exemple #3
0
 /// <summary>
 /// 获取实体
 /// </summary>
 /// <returns></returns>
 /// <summary>
 public JsonResult loadmodel(string id, string type)
 {
     using (var manage = new Data.CMSManage())
     {
         if (type == "#dictionary")
         {
             return(getResult(0, "", manage.getDictionaryInfo(Utils.strToInt(id))));
         }
         else
         {
             var key = manage.getDictionaryKeyInfo(Utils.strToInt(id));
             Entity.DictionaryInfo dictionary = null;
             if (key != null)
             {
                 dictionary = manage.getDictionaryInfo(key.DictionaryCode);
             }
             return(getResult(0, "", new
             {
                 dictionary = dictionary,
                 dictionarykey = key
             }));
         }
     }
 }