Example #1
0
        /// <summary>
        /// 添加标签配置
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public static int InsertArticleTabConfig(SqlConnection conn, ArticleTabConfig config)
        {
            const string sql = @"
            INSERT  INTO Configuration..ArticleTabConfig
                    ( NormalImg ,
                      SelectedImg ,
                      Source ,
                      CreateUser ,
                      CreateTime ,
                      UpdateTime
                    )
            VALUES  ( @NormalImg ,
                      @SelectedImg ,
                      @Source ,
                      @CreateUser ,
                      GETDATE() ,
                      GETDATE()
                    )";

            return(Convert.ToInt32(conn.Execute(sql, new
            {
                NormalImg = config.NormalImg,
                SelectedImg = config.SelectedImg,
                CreateUser = config.CreateUser,
                Source = config.Source.ToString()
            }, commandType: CommandType.Text)));
        }
Example #2
0
        /// <summary>
        /// 添加标签配置
        /// </summary>
        /// <param name="config"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool InsertArticleTabConfig(ArticleTabConfig config, string user)
        {
            var result = false;

            try
            {
                if (config != null)
                {
                    config.Source     = TagSource.TuhuWangPai;
                    config.CreateUser = user;
                    result            = dbScopeManager.Execute(conn => DalTagConfig.InsertArticleTabConfig(conn, config)) > 0;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
        /// <summary>
        /// 添加标签配置
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public JsonResult InsertArticleTabConfig(ArticleTabConfig config)
        {
            var result = TagConfigManager.InsertArticleTabConfig(config, User.Identity.Name);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }