public async Task <ActionResult> StartMatch(Guid matchId) { var startMatchCommand = new StartMatchCommand(matchId); await _commandHandler.StartMatch(startMatchCommand); return(Ok()); }
/// <summary> /// Start a match /// </summary> /// <param name="matchKey"></param> /// <param name="gameKey"></param> /// <param name="locationKeys"></param> /// <param name="templateKey"></param> /// <param name="config"></param> /// <param name="endCallbackUrl"></param> /// <returns>An awaitable task that finishes when the command is executed</returns> public async Task CommandStartMatch(string matchKey, string gameKey, string[] locationKeys, string templateKey, Dictionary <string, object> config, string endCallbackUrl = null) { var command = new StartMatchCommand { Payload = { MatchKey = matchKey, GameKey = gameKey, LocationKeys = locationKeys, TemplateKey = templateKey, Config = config, EndCallbackUrl = endCallbackUrl } }; await Command.Invoke($"{clientConfig.Endpoint}/action/{command.Type}", command.Payload, CommandHeaders); }
public async Task <IActionResult> StartMatch([FromBody] StartMatchCommand command) { await Mediator.Send(command); return(NoContent()); }