Changed await
This commit is contained in:
@@ -111,22 +111,14 @@ public class UserService : BaseService, IUserService
|
|||||||
{
|
{
|
||||||
User? user = null;
|
User? user = null;
|
||||||
|
|
||||||
await using var transaction = await _sqlServerContext.Database.BeginTransactionAsync();
|
using (var transaction = await _sqlServerContext.Database.BeginTransactionAsync())
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var tempUser = this.CreateUserData(data, role);
|
var tempUser = CreateUserData(data, role);
|
||||||
await _sqlServerContext.Users.AddAsync(tempUser);
|
await _sqlServerContext.Users.AddAsync(tempUser);
|
||||||
await _sqlServerContext.SaveChangesAsync();
|
await _sqlServerContext.SaveChangesAsync();
|
||||||
|
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
user = tempUser;
|
user = tempUser;
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{
|
|
||||||
await transaction.RollbackAsync();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user