public async Task <bool> Transaction(Action action) { bool isCommitted = default; Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction transaction = null; try { transaction = AppDbContext.Database.BeginTransaction(); action.Invoke(); SetAudit(); await transaction.CommitAsync(); } catch (Exception exception) { await transaction.RollbackAsync(); Logger.WriteLog(logType: CommonEnum.LogLevelEnum.Error, MethodBase.GetCurrentMethod(), exception: exception); } return(isCommitted); }