Esempio n. 1
0
        public async Task <IActionResult> StartTournament([FromBody] StartTournament startTournament)
        {
            if (startTournament.PlayerIds.Count() > 16)
            {
                return(BadRequest());
            }
            else
            {
                var    userId = accountService.GetUserId();
                string tournamentId;
                int    newTournament;

                if (startTournament.TournamentId == "")
                {
                    newTournament = await service.CreateTournamentAsync(startTournament, userId);

                    tournamentId = newTournament.ToString();
                }
                else
                {
                    tournamentId = startTournament.TournamentId;
                }
                return(Json(tournamentId));
            }
        }