Exemple #1
0
 public HomeController(ITournamentService tournamentService, IMapper mapper, SignInManager <AppUser> signInManager, UserManager <AppUser> userManager) : base(userManager)
 {
     _tournamentService = tournamentService;
     _mapper            = mapper;
     _signInManager     = signInManager;
     _userManager       = userManager;
 }
Exemple #2
0
        public StatisticsController(ITournamentService tournamentService, IHeroService heroService, IStatsHelper statsHelper)
        {
            _tournamentService = tournamentService;
            _heroService       = heroService;

            _statsHelper = statsHelper;
        }
 public TournamentStartJob(ILifetimeScope scope)
     : base(scope)
 {
     this.unitOfWork        = this.LifetimeScope.Resolve <IUnitOfWork>();
     this.tournamentService = this.LifetimeScope.Resolve <ITournamentService>();
     this.randomGenProvider = this.LifetimeScope.Resolve <IRandomGenProvider>();
 }
Exemple #4
0
 public TournamentController(IMapper mapper, ITournamentService tournamentService, IPlayedGamesService playedGamesService, ITournamentTeamsService tournamentTeamsService, UserManager <AppUser> userManager) : base(userManager)
 {
     _mapper                 = mapper;
     _tournamentService      = tournamentService;
     _playedGamesService     = playedGamesService;
     _tournamentTeamsService = tournamentTeamsService;
 }
        public RebaseController(
            IChampionService championService,
            IItemService itemService,
            ILeagueService leagueService,
            IMasteryService masteryService,
            IMatchService matchService,
            IPlayerService playerService,
            ITeamService teamService,
            ITournamentService tournamentService,
            ISpellService spellService,
            ISerieService serieService,
            ILogger <RebaseController> logger)
        {
            _championService   = championService ?? throw new ArgumentNullException(nameof(championService));
            _itemService       = itemService ?? throw new ArgumentNullException(nameof(itemService));
            _leagueService     = leagueService ?? throw new ArgumentNullException(nameof(leagueService));
            _masteryService    = masteryService ?? throw new ArgumentNullException(nameof(masteryService));
            _matchService      = matchService ?? throw new ArgumentNullException(nameof(matchService));
            _playerService     = playerService ?? throw new ArgumentNullException(nameof(playerService));
            _serieService      = serieService ?? throw new ArgumentNullException(nameof(serieService));
            _spellService      = spellService ?? throw new ArgumentNullException(nameof(spellService));
            _teamService       = teamService ?? throw new ArgumentNullException(nameof(teamService));
            _tournamentService = tournamentService ?? throw new ArgumentNullException(nameof(tournamentService));

            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            pandaScoreAccessToken = Environment.GetEnvironmentVariable("PandaScoreAPIAccessToken");
        }
        private UIElement Add(IEnumerable <string> sportNames)
        {
            TournamentCreateViewModel viewModel = new TournamentCreateViewModel(sportNames);
            TournamentCreateControl   control   = new TournamentCreateControl(viewModel);

            viewModel.TournamentCreated += (s, e) =>
            {
                TournamentBaseModel tournamentCreateModel = e.Tournament;
                TournamentBaseDTO   tournamentCreateDTO   = Mapper.Map <TournamentBaseModel, TournamentBaseDTO>(tournamentCreateModel);

                using (ITournamentService service = factory.CreateTournamentService())
                {
                    ServiceMessage serviceMessage = service.Create(tournamentCreateDTO);
                    RaiseReceivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);

                    if (serviceMessage.IsSuccessful)
                    {
                        Notify();
                        viewModel.Name = String.Empty;
                    }
                }
            };

            return(control);
        }
 public TournamentAdminController(ITournamentService tournamentService, ITennisClubService tennisClubService, IPlayerService playerService, IAddressService addressService)
 {
     _tournamentService = tournamentService;
     _tennisClubService = tennisClubService;
     _playerService = playerService;
     _addressService = addressService;
 }
        public async Task CreateShouldAddNewTournament()
        {
            const string       databaseName = "TournamentCreate";
            ITournamentService service      = await GetTournamentService(databaseName);

            //Act
            TournamentFormModel expectedModel = new TournamentFormModel()
            {
                Id              = 5,
                Name            = "SandanskiOpen",
                StartDate       = new DateTime(),
                Place           = "Sandanski",
                NumberOfPlayers = 16,
                Type            = Domain.Enums.Tournament.TournamentType.Charity
            };

            await service.Create(expectedModel, new Guid().ToString());

            var db          = new FakeSportDbContext(databaseName);
            var actualModel = db.Data.Tournaments.FirstOrDefault(t => t.Id == 5);

            //Assert
            Assert.True(expectedModel.Id == actualModel.Id);
            Assert.True(expectedModel.Name.Equals(actualModel.Name));
            Assert.True(expectedModel.StartDate == actualModel.StartDate);
            Assert.True(expectedModel.NumberOfPlayers == actualModel.NumberOfPlayers);
            Assert.True(expectedModel.Place.Equals(actualModel.Place));
        }
 public TournamentController(IMapper mapper, ITeamService teamService, UserManager <AppUser> userManager, ITournamentService tournamentService, ITournamentTeamsService tournamentTeamsService)
 {
     _mapper                 = mapper;
     _teamService            = teamService;
     _userManager            = userManager;
     _tournamentService      = tournamentService;
     _tournamentTeamsService = tournamentTeamsService;
 }
 public TimelinesController(ITimelineService _timelineService, IRefereeService _refereeService,
                            IGeneralUnitService _generalUnitService, ITournamentService _tournamentService)
 {
     timelineService    = _timelineService;
     refereeService     = _refereeService;
     generalUnitService = _generalUnitService;
     tournamentService  = _tournamentService;
 }
 public TournamentController(ITournamentService tournamentService, UserManager <IdentityUser> userManager,
                             IMatchService matchService, AppDbContext dbContext)
 {
     this.tournamentService = tournamentService;
     this.userManager       = userManager;
     this.matchService      = matchService;
     this.dbContext         = dbContext;
 }
        public TournamentController(ITournamentService tournamentService, IDivisionService divisionService)
        {
            Guard.WhenArgument(tournamentService, nameof(tournamentService)).IsNull().Throw();
            Guard.WhenArgument(divisionService, nameof(divisionService)).IsNull().Throw();

            this.tournamentService = tournamentService;
            this.divisionService   = divisionService;
        }
Exemple #13
0
 public TournamentController(ITournamentService tournamentService,
                             IManageTournamentService manageTournamentService,
                             ICommandDispatcher commandDispatcher
                             ) : base(commandDispatcher)
 {
     _tournamentService       = tournamentService;
     _manageTournamentService = manageTournamentService;
 }
 public TournamentController(IStadiumService stadiumService, IGameServerService gameServerService, ITournamentService tournamentService, IMapper mapper, ITeamService teamService, ITournamentTeamsService tournamentTeamsService)
 {
     _stadiumService         = stadiumService;
     _gameServerService      = gameServerService;
     _tournamentService      = tournamentService;
     _teamService            = teamService;
     _mapper                 = mapper;
     _tournamentTeamsService = tournamentTeamsService;
 }
Exemple #15
0
 public TournamentsController(
     UserManager <User> userManager,
     ITournamentService tournaments,
     IUserService users)
 {
     this.tournaments = tournaments;
     this.userManager = userManager;
     this.users       = users;
 }
Exemple #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TournamentsController"/> class.
 /// </summary>
 /// <param name="tournamentService"> The tournament service. </param>
 /// <param name="gameService"> The game service. </param>
 /// <param name="gameReportService"> The game report service. </param>
 public TournamentsController(
     ITournamentService tournamentService,
     IGameService gameService,
     IGameReportService gameReportService)
 {
     _tournamentService = tournamentService;
     _gameService       = gameService;
     _gameReportService = gameReportService;
 }
Exemple #17
0
        public TournamentController(ITournamentService tournamentService, IFederationService federationService, IRoundService roundService)
        {
            _tournamentService = tournamentService;
            _roundService      = roundService;

            var federations = federationService.GetAll();

            ViewBag.Federations = Mapper.Map <IEnumerable <Federation>, IEnumerable <FederationViewModel> >(federations);
        }
Exemple #18
0
        public UIElement GetAddElement()
        {
            UIElement element = null;

            DataServiceMessage <IEnumerable <string> > sportServiceMessage;
            DataServiceMessage <IEnumerable <TournamentDisplayDTO> >     tournamentServiceMessage;
            DataServiceMessage <IEnumerable <ParticipantTournamentDTO> > participantServiceMessage;

            using (ITournamentService service = factory.CreateTournamentService())
            {
                tournamentServiceMessage = service.GetAll();
                RaiseReceivedMessageEvent(tournamentServiceMessage.IsSuccessful, tournamentServiceMessage.Message);
            }
            using (ISportService service = factory.CreateSportService())
            {
                sportServiceMessage = service.GetAll();
                RaiseReceivedMessageEvent(sportServiceMessage.IsSuccessful, sportServiceMessage.Message);
            }
            using (IParticipantService service = factory.CreateParticipantService())
            {
                participantServiceMessage = service.GetAllWithTournaments();
                RaiseReceivedMessageEvent(sportServiceMessage.IsSuccessful, sportServiceMessage.Message);
            }

            if (tournamentServiceMessage.IsSuccessful && sportServiceMessage.IsSuccessful && participantServiceMessage.IsSuccessful)
            {
                IEnumerable <string> sports = sportServiceMessage.Data;
                IEnumerable <TournamentDisplayDTO>     tournamentDisplayDTOs     = tournamentServiceMessage.Data;
                IEnumerable <ParticipantTournamentDTO> participantTournamentDTOs = participantServiceMessage.Data;

                IEnumerable <TournamentBaseModel> tournamentBaseModels = tournamentDisplayDTOs
                                                                         .Select(t => Mapper.Map <TournamentDisplayDTO, TournamentBaseModel>(t))
                                                                         .ToList();
                IEnumerable <ParticipantTournamentModel> participantTournamentModels = participantTournamentDTOs
                                                                                       .Select(p => Mapper.Map <ParticipantTournamentDTO, ParticipantTournamentModel>(p))
                                                                                       .ToList();

                element = Add(sports, tournamentBaseModels, participantTournamentModels);
            }
            else
            {
                List <ServiceMessage> messages = new List <ServiceMessage>()
                {
                    sportServiceMessage,
                    tournamentServiceMessage,
                    participantServiceMessage
                };

                ErrorViewModel viewModel = new ErrorViewModel(messages);
                ErrorControl   control   = new ErrorControl(viewModel);

                element = control;
            }

            return(element);
        }
        public TournamentRegisterTeamValidator(UserManager <AppUser> userManager, ITournamentService tournamentService, ITeamService teamService)
        {
            _tournamentService = tournamentService;
            _userManager       = userManager;
            _teamService       = teamService;

            RuleFor(I => I.TournamentId).Must(I => IsUpcoming(I)).WithMessage("Tournament is already started/finished.");
            RuleFor(I => I).Must(I => IsUserTeamOwner(I)).WithMessage("You are not owner of this team.");
            RuleFor(I => I).Must(I => !IsUserRegisteredAnotherTeam(I)).WithMessage("You already registered your own other team.");
        }
 public TournamentController(
     ILogger <TournamentController> logger,
     ITournamentService tournamentService,
     IMapper mapper)
 {
     _mapper            = mapper;
     _logger            = logger;
     _tournamentService = tournamentService;
     _logger.LogInformation("TestController");
 }
Exemple #21
0
 public Sync(
     ITournamentService tournamentService,
     IPlayerService playerService,
     IGoalscorerService goalscorerService
     )
 {
     this._tournamentService = tournamentService;
     this._playerService     = playerService;
     this._goalscorerService = goalscorerService;
 }
Exemple #22
0
 public CartItemsController(ICartRepository cartRepository,
                            ICartItemsRepository cartItemsRepository, ITournamentRepository tournamentRepository,
                            ITournamentService tournamentService, IMapper mapper)
 {
     _cartRepository       = cartRepository;
     _cartItemsRepository  = cartItemsRepository;
     _tournamentRepository = tournamentRepository;
     _tournamentService    = tournamentService;
     _mapper = mapper;
 }
 public ResultingController(
     ILogger <HomeController> logger,
     ITournamentService tournamentService,
     IStatsService statsService,
     IMapper mapper)
 {
     _logger            = logger;
     _tournamentService = tournamentService;
     _mapper            = mapper;
     _statsService      = statsService;
 }
        public UIElement GetAddElement()
        {
            UIElement element = null;

            DataServiceMessage <IEnumerable <string> > sportServiceMessage;
            DataServiceMessage <IEnumerable <TournamentDisplayDTO> > tournamentServiceMessage;
            DataServiceMessage <IEnumerable <EventDisplayDTO> >      eventServiceMessage;

            using (ISportService service = factory.CreateSportService())
            {
                sportServiceMessage = service.GetAll();
                RaiseReceivedMessageEvent(sportServiceMessage.IsSuccessful, sportServiceMessage.Message);
            }
            using (ITournamentService service = factory.CreateTournamentService())
            {
                tournamentServiceMessage = service.GetAll();
                RaiseReceivedMessageEvent(sportServiceMessage.IsSuccessful, sportServiceMessage.Message);
            }
            using (IEventService service = factory.CreateEventService())
            {
                eventServiceMessage = service.GetAll();
                RaiseReceivedMessageEvent(sportServiceMessage.IsSuccessful, sportServiceMessage.Message);
            }

            if (sportServiceMessage.IsSuccessful && tournamentServiceMessage.IsSuccessful && eventServiceMessage.IsSuccessful)
            {
                IEnumerable <TournamentBaseDTO> tournamentDTOs = tournamentServiceMessage.Data.AsEnumerable <TournamentBaseDTO>();
                IEnumerable <EventBaseDTO>      eventDTOs      = eventServiceMessage.Data.AsEnumerable <EventBaseDTO>();

                IEnumerable <string> sports = sportServiceMessage.Data;
                IEnumerable <TournamentBaseModel> tournaments = tournamentDTOs
                                                                .Select(t => Mapper.Map <TournamentBaseDTO, TournamentBaseModel>(t));
                IEnumerable <EventBaseModel> events = eventDTOs
                                                      .Select(e => Mapper.Map <EventBaseDTO, EventBaseModel>(e));

                element = Add(sports, tournaments, events);
            }
            else
            {
                List <ServiceMessage> messages = new List <ServiceMessage>()
                {
                    sportServiceMessage,
                    tournamentServiceMessage,
                    eventServiceMessage
                };

                ErrorViewModel viewModel = new ErrorViewModel(messages);
                ErrorControl   control   = new ErrorControl(viewModel);

                element = control;
            }

            return(element);
        }
 public TournamentController(
     ILogger <HomeController> logger,
     ITournamentService tournamentService,
     IMapper mapper,
     IStatsService ss)
 {
     _logger            = logger;
     _tournamentService = tournamentService;
     _mapper            = mapper;
     _ss = ss;
 }
 public TournamentsController(
     IModeratorTournamentService moderatorTournaments,
     IGameService games,
     ITeamService teams,
     ITournamentService tournaments)
 {
     this.moderatorTournaments = moderatorTournaments;
     this.games       = games;
     this.teams       = teams;
     this.tournaments = tournaments;
 }
Exemple #27
0
 public UserController(
     ILogger <UserController> logger,
     IUserService userService,
     ITournamentService tournamentService,
     IMapper mapper)
 {
     _logger            = logger;
     _userService       = userService;
     _tournamentService = tournamentService;
     _mapper            = mapper;
 }
Exemple #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TournamentRequestController"/> class.
 /// </summary>
 /// <param name="requestService"> The request service.</param>
 /// <param name="userService"> The user service.</param>
 /// <param name="teamService">The team service.</param>
 /// <param name="tournamentService">The tournament service.</param>
 public TournamentRequestController(
     ITournamentRequestService requestService,
     IUserService userService,
     ITeamService teamService,
     ITournamentService tournamentService)
 {
     _teamService       = teamService;
     _requestService    = requestService;
     _userService       = userService;
     _tournamentService = tournamentService;
 }
Exemple #29
0
 public TournamentServiceTests()
 {
     mockTournamentRepository       = new Mock <ITournamentRepository>();
     mockTournamentPlayerRepository = new Mock <ITournamentPlayerRepository>();
     mockPlayerRepository           = new Mock <IPlayerRepository>();
     tournamentService =
         new TournamentService(
             mockTournamentRepository.Object,
             mockPlayerRepository.Object,
             mockTournamentPlayerRepository.Object
             );
 }
Exemple #30
0
 public CategoriesController(ICategoryService _categoryService,
                             ITournamentService _tournamentService,
                             IFightService _fightService,
                             IFighterService _fighterService,
                             INavigationService _navigationService)
 {
     categoryService   = _categoryService;
     tournamentService = _tournamentService;
     fightService      = _fightService;
     navigationService = _navigationService;
     fighterService    = _fighterService;
 }
 public TeamsController(ITournamentService _tournamentService,
                        ITeamService _teamService,
                        IGeneralUnitService _generalUnitService,
                        ISportUnitService _sportUnitService,
                        INavigationService _navigationService)
 {
     tournamentService  = _tournamentService;
     teamService        = _teamService;
     generalUnitService = _generalUnitService;
     sportUnitService   = _sportUnitService;
     navigationService  = _navigationService;
 }
 public TournamentStartJob(ILifetimeScope scope)
     : base(scope)
 {
     this.unitOfWork = this.LifetimeScope.Resolve<IUnitOfWork>();
     this.tournamentService = this.LifetimeScope.Resolve<ITournamentService>(); ;
 }
 public TournamentController(ITournamentService tournamentService)
 {
     this.tournamentService = tournamentService;
 }
 public TournamentController(IApplicationSettings applicationSettings, ITournamentService  tournamentService)
 {
     this._applicationSettings = applicationSettings;
     this._tournamentService = tournamentService;
 }
 public TournamentController(IPlayerService playerService, IChallengeService challengeService, ITournamentService tournamentService)
 {
     _playerService = playerService;
     _challengeService = challengeService;
     _tournamentService = tournamentService;
 }