Пример #1
0
        /// <summary>
        /// SetLockoutAsync
        /// </summary>
        /// <param name="userGuid"></param>
        /// <param name="lockout"></param>
        /// <param name="lockoutTimeSpan"></param>
        /// <returns></returns>
        /// <exception cref="DatabaseException"></exception>
        public async Task SetLockoutAsync <TUser>(string userGuid, bool lockout, TimeSpan?lockoutTimeSpan = null) where TUser : IdenityUser, new()
        {
            TransactionContext transactionContext = await _database.BeginTransactionAsync <TUser>(IsolationLevel.ReadCommitted).ConfigureAwait(false);

            try
            {
                await _userBiz.SetLockoutAsync <TUser>(userGuid, lockout, transactionContext, lockoutTimeSpan).ConfigureAwait(false);

                await _database.CommitAsync(transactionContext).ConfigureAwait(false);
            }
            catch
            {
                await _database.RollbackAsync(transactionContext).ConfigureAwait(false);

                throw;
            }
        }