public ActionResult Edit(BusinessKeywordsConfig model)
        {
            string js = "<script>alert(\"保存失败 \");location='/BusinessKeywordsConfig/Index';</script>";

            if (model.Id != 0)
            {
                if (BusinessKeywordsConfigManager.UpdateBusinessKeywordsConfig(model))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(Content(js));
                }
            }
            else
            {
                if (BusinessKeywordsConfigManager.InsertBusinessKeywordsConfig(model))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(Content(js));
                }
            }
        }
        public static bool UpdateBusinessKeywordsConfig(BusinessKeywordsConfig model)
        {
            const string sql          = @"UPDATE Configuration..BusinessKeywordsConfig SET                                      
                                              Keywords=@Keywords                                        
                                              ,CreateTime=GETDATE(),
                                               Sort=@Sort
                                WHERE Id=@Id";
            var          sqlParameter = new SqlParameter[]
            {
                new SqlParameter("@Keywords", model.Keywords ?? string.Empty),
                new SqlParameter("@Id", model.Id),
                new SqlParameter("@Sort", model.Sort)
            };

            return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0);
        }
 public bool InsertBusinessKeywordsConfig(BusinessKeywordsConfig model)
 {
     try
     {
         return(DALBusinessKeywordsConfig.InsertBusinessKeywordsConfig(model));
     }
     catch (TuhuBizException)
     {
         throw;
     }
     catch (Exception ex)
     {
         var exception = new BusinessKeywordsConfigException(1, "InsertBusinessKeywordsConfig", ex);
         Logger.Log(Level.Error, exception, "InsertBusinessKeywordsConfig");
         throw ex;
     }
 }
        public static bool InsertBusinessKeywordsConfig(BusinessKeywordsConfig model)
        {
            const string sql = @"  INSERT INTO Configuration..BusinessKeywordsConfig
                                          ([Keywords]
                                          ,[CreateTime]
                                          ,Sort
                                          )
                                  VALUES( @Keywords
                                          ,GETDATE() 
                                          ,@Sort                                         
                                        )";

            var sqlParameter = new SqlParameter[]
            {
                new SqlParameter("@Keywords", model.Keywords),
                new SqlParameter("@Sort", model.Sort)
            };

            return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0);
        }