public JsonResult AddTeamsToTournament(TournamentTeamsListViewModel groupTeams) { JsonResult result = null; try { _tournamentService.AddTeamsToTournament(groupTeams.ToGroupTeamDomain()); result = Json(groupTeams, JsonRequestBehavior.AllowGet); } catch (ArgumentException ex) { result = Json(new TeamsAddToTournamentViewModel { Message = ex.Message }); } return(result); }
/// <summary> /// Confirm the request /// </summary> /// <param name="requestId">Request's id</param> public void Confirm(int requestId) { _authService.CheckAccess(AuthOperations.TournamentRequests.Confirm); var tournamentRequest = Get(requestId); if (tournamentRequest == null) { throw new MissingEntityException(ServiceResources.ExceptionMessages.TournamentRequestNotFound, requestId); } _tournamentService.AddTeamsToTournament(new List <TeamTournamentAssignmentDto> { new TeamTournamentAssignmentDto { TeamId = tournamentRequest.TeamId, GroupId = tournamentRequest.GroupId } }); NotifyUser(_userService.GetUser(Get(requestId).UserId).Email); _tournamentRequestRepository.Remove(requestId); _tournamentRequestRepository.UnitOfWork.Commit(); }