public static void SetupTestData() { for (int i = 1; i <= 20; i++) { var playerName = "Player " + i; Db.Execute(new AddPlayerCommand() {Email = playerName, Name = playerName}); } var startDate = new DateTime(2012, 5, 13); var command = new CreateRoundCommand(4, startDate); Db.Execute(command); }
public IActionResult Create_round(CreateRoundCommand create_round_command) { _logger.LogInformation($"create round command: { create_round_command.TournamentId }"); using (var msgpump = new MessagePump(_es)) { var id_provider = new IdProvider(); var context_manager = new CreateRoundCommandContextManager(_es); var message_processor = new CreateRoundCommandProcessor(id_provider); msgpump.Register <CreateRoundCommand>(context_manager, message_processor); var result = msgpump.Handle(create_round_command) as CommandStatus; if (result is Success) { return(Ok()); } else { return(BadRequest()); } } }