Exemplo n.º 1
0
 /// <summary>
 ///更新车系信息 
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int UpdateCarSeries(BaseCarSeriesModel model)
 {
     var sql = new StringBuilder("update `base_carseries` set ");
     sql.Append(Helper.CreateField(model).Trim().TrimEnd(','));
     sql.Append(" where innerid = @innerid");
     int result;
     try
     {
         result = Helper.Execute(sql.ToString(), model);
     }
     catch (Exception ex)
     {
         result = 0;
     }
     return result;
 }
Exemplo n.º 2
0
 /// <summary>
 /// 添加车系信息AddCarSeries
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddCarSeries(BaseCarSeriesModel model)
 {
     const string sql = @"INSERT INTO `base_carseries`
                         (`innerid`,`seriesname`,`seriesgroupname`,`brandid`,`isenabled`,`remark`,hot)
                         VALUES
                         (@innerid,@seriesname,@seriesgroupname,@brandid,@isenabled,@remark,@hot);";
     using (var conn = Helper.GetConnection())
     {
         var tran = conn.BeginTransaction();
         try
         {
             conn.Execute(sql, model, tran);
             tran.Commit();
             return 1;
         }
         catch (Exception ex)
         {
             tran.Rollback();
             return 0;
         }
     }
 }