李昊 4 years ago
parent
commit
d5bf35c020

+ 4 - 4
gx_api/GxPress/Repository/GxPress.Repository.Implement/MiddleRepository.cs

@@ -174,10 +174,10 @@ namespace GxPress.Repository.Implement
             var databaseType = _databaseTypeStr.ToEnum<DatabaseType>(DatabaseType.MySql);
             var databaseType = _databaseTypeStr.ToEnum<DatabaseType>(DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
             var connection = database.GetConnection();
-            //return await _repository.UpdateAsync(Q.Set(nameof(Middle.IsTop), !middle.IsTop).Where(nameof(Middle.Id), id)) > 0;
-            var isTop = middle.IsTop == true ? 0 : 1;
-            var sql = $"update tede_middle set IsTop={isTop} where id={id}";
-            return await connection.ExecuteAsync(sql) > 0;
+            return await _repository.UpdateAsync(Q.Set(nameof(Middle.IsTop), !middle.IsTop).Where(nameof(Middle.Id), id)) > 0;
+            // var isTop = middle.IsTop == true ? 0 : 1;
+            // var sql = $"update tede_middle set IsTop={isTop} where id={id}";
+            // return await connection.ExecuteAsync(sql) > 0;
         }
         }
 
 
         public async Task<bool> DeleteAsync(NoticeDeRequest request)
         public async Task<bool> DeleteAsync(NoticeDeRequest request)