File tree Expand file tree Collapse file tree
Repositories/Resgrid.Repositories.DataRepository Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,8 +24,10 @@ public async Task<bool> DeleteDepartmentAndUsersAsync(int departmentId)
2424
2525 if ( Config . DataConfig . DatabaseType == DatabaseTypes . SqlServer )
2626 {
27- using ( IDbConnection db = new SqlConnection ( DataConfig . CoreConnectionString ) )
27+ using ( var db = new SqlConnection ( DataConfig . CoreConnectionString ) )
2828 {
29+ await db . OpenAsync ( ) ;
30+
2931 using ( var transaction = db . BeginTransaction ( ) )
3032 {
3133 var result = await db . ExecuteAsync ( @"
@@ -171,13 +173,13 @@ DELETE FROM [dbo].[MessageRecipients] WHERE MessageId IN (SELECT MessageId FROM
171173 DELETE FROM [dbo].[AspNetUsersExt] WHERE UserId = @ManagingUserId
172174 DELETE FROM [dbo].[AspNetUsers] WHERE Id = @ManagingUserId
173175 " ,
174- new { DepartmentId = departmentId } ) ;
176+ new { DepartmentId = departmentId } , transaction ) ;
175177
176178 transaction . Commit ( ) ;
177179 }
178180 }
179181
180- return false ;
182+ return true ;
181183 }
182184
183185 return false ;
You can’t perform that action at this time.
0 commit comments