public async Task <IActionResult> PayInAsync([FromBody] PayInRequest request) { Logger.LogDebug(nameof(PayInAsync)); // Validate model if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // Get Player if exists var player = await _playerRepository.GetAsync(request.PlayerId).ConfigureAwait(false); // Create new transaction var transaction = new Transaction { PlayerId = player.PlayerId, PayIn = request.PayIn }; // Persist Transaction await _transactionRepository.AddAsync(transaction).ConfigureAwait(false); // Re-read Player player = await _playerRepository.GetAsync(request.PlayerId).ConfigureAwait(false); return(Ok(player)); }
public async Task PlayerPayInTest() { var request = new PayInRequest { PlayerId = 1, PayIn = 1500 }; var result = await _httpClientHelper.PostAsync <PayInRequest, Player>(BASE_URL + "payIn", request).ConfigureAwait(false); Assert.NotNull(result); }