/// <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); }
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); }
/// <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); }
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); }