public async Task <ActionResult> GetInfoForCreate(Guid playerId) { var player = _playerQueries.GetPlayer(playerId); if (player == null) { throw new ArgumentException(@"Player was not found", nameof(playerId)); } if (!_adminQueries.IsBrandAllowed(CurrentUser.Id, player.BrandId)) { throw new HttpException(403, "Access forbidden"); } var ensureOrWaitUserRegisteredTask = _bonusApiProxy.EnsureOrWaitPlayerRegistered(playerId); var depositBonusesTask = _bonusApiProxy.GetDepositQualifiedBonusesByAdminAsync(playerId); var bankAccounts = GetAdminApiProxy(Request).GetBankAccountsByPlayerId(playerId).BankAccounts; var bankData = bankAccounts .Select(bankAccount => new { bankAccount.Id, Name = $"{bankAccount.Bank.BankName} / {bankAccount.AccountName}" }); await ensureOrWaitUserRegisteredTask; return(this.Success(new { Banks = bankData, player.Username, Bonuses = await depositBonusesTask })); }
public async Task <IEnumerable <QualifiedBonus> > GetVisibleDepositQualifiedBonuses([FromUri] QualifiedBonusRequest request) { List <DepositQualifiedBonus> bonuses; await _bonusApiProxy.EnsureOrWaitPlayerRegistered(PlayerId); if (request.Amount.HasValue) { bonuses = await _bonusApiProxy.GetVisibleDepositQualifiedBonuses(PlayerId, request.Amount.Value); } else { bonuses = await _bonusApiProxy.GetVisibleDepositQualifiedBonuses(PlayerId); } if (bonuses == null) { throw new RegoValidationException(ErrorMessagesEnum.ServiceUnavailable.ToString()); } return(bonuses.Select(Convert)); }