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(); }
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." })); }