public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { try { _dbContext.BeginTransaction(); await next(); await _dbContext.CommitTransactionAsync(); } catch (Exception) { _dbContext.RollbackTransaction(); throw; } }