public async Task <ActionResult <Response <TournamentViewModel> > > PostAsync([FromBody] CreateTournamentViewModel model) { var response = await _service.CreateAsync(model); if (response.Success) { return(Created(nameof(PostAsync), response)); } return(BadRequest(response)); }
public async Task CreateAsync(string name, string format) { Enum.TryParse(format, ignoreCase: true, out TournamentFormat tournamentFormat); if (tournamentFormat == TournamentFormat.None) { await ReplyAsync($"Invalid tournament format: {format}"); return; } await ReplyAsync($"Creating new {format} {name} tournament."); await _tournamentService.CreateAsync(name, tournamentFormat); }
public async Task HandleAsync(CreateTournament command) { await _tournamentService.CreateAsync(command.Name, command.MaxPlayers); }