public async Task <IActionResult> MarkField(string gameId, [FromBody] MarkFieldRequest request, CancellationToken cancellationToken) { var userId = User.GetUserId(); var command = MarkFieldMapper.ToCommand(gameId, userId, request); await _markFieldCommandHandler.HandleAsync(command, cancellationToken).ConfigureAwait(false); return(Ok()); }
public static MarkFieldCommand ToCommand(string gameId, string playerId, MarkFieldRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return(new MarkFieldCommand { GameId = gameId, PlayerId = playerId, Row = request.Row, Column = request.Column, MarkType = request.MarkType }); }