예제 #1
0
        public async Task AddTournament(TournamentAddModel tournamentAddModel, Group group, User user)
        {
            tournamentAddModel.Validate();
            ValidateTournament(group, user);
            await _context.Tournaments.AddAsync(tournamentAddModel.ConvertToTournament(group));

            await _context.SaveChangesAsync();
        }
예제 #2
0
        public async Task <IActionResult> AddTournament(int id, [FromBody] TournamentAddModel tournamentAddModel)
        {
            var user = await _userService.GetOneByEmail(User.Identity.Name);

            var group = await _groupService.GetOneById(id, user);

            await _groupService.AddTournament(tournamentAddModel, group, user);

            return(Ok(new { message = "Torneio incluído com sucesso." }));
        }