コード例 #1
0
 /// <summary>
 /// 添加或编辑
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static int Create(ArticleInfo model)
 {
     if (model.Id > 0)
     {
         //Update
         ArticleManage.Update(model);
     }
     else
     {
         int i = ArticleManage.Insert(model);
         model.Id = i;
     }
     return(model.Id);
 }
コード例 #2
0
ファイル: ArticleService.cs プロジェクト: lvjialiang/PlantEng
 public static ArticleInfo Create(ArticleInfo model)
 {
     if (model.Id == 0)
     {
         //Insert
         int id = ArticleManage.Insert(model);
         model.Id = id;
     }
     else
     {
         ArticleManage.Update(model);
     }
     //插入ArticleTags表
     ArticleManage.InsertArticleTagData(model.Id, model.Tags);
     return(model);
 }
コード例 #3
0
        /// <summary>
        /// 添加或编辑
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int Create(ArticleInfo model)
        {
            //处理一下关键词
            if (!string.IsNullOrEmpty(model.Keywords))
            {
                model.Keywords = Regex.Replace(model.Keywords, @"(\s+|,)", ",");
            }

            if (model.Id > 0)
            {
                //Update
                ArticleManage.Update(model);
            }
            else
            {
                int i = ArticleManage.Insert(model);
                model.Id = i;
            }
            return(model.Id);
        }
コード例 #4
0
        private const int CACHETIMEOUT = 0;//缓存30分钟

        #region == Edit OR Add ==
        /// <summary>
        /// 添加或编辑
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int Create(ArticleInfo model)
        {
            if (model.Id > 0)
            {
                //Update
                ArticleManage.Update(model);
            }
            else
            {
                int i = ArticleManage.Insert(model);
                model.Id = i;
            }
            //Insert ArticleTag

            string[] tags = model.Tags.Split(new char[] { ',' });
            if (tags.Length > 0)
            {
                ArticleManage.InsertTags(model.Id, tags);
            }
            return(model.Id);
        }