Пример #1
0
        public MatchesController(IMatchesService matchesService)
        {
            Guard.WhenArgument(matchesService, nameof(matchesService)).IsNull().Throw();

            this.matchesService = matchesService;
        }
Пример #2
0
 public MatchesController(IMatchesService matchesService, ITeamsService teamsService, IPointsCalculator pointsCalculator)
 {
     this.matchesService   = matchesService;
     this.teamsService     = teamsService;
     this.pointsCalculator = pointsCalculator;
 }
Пример #3
0
 public MatchesController(IMatchesService matchesServices, IPlayersService playersServices)
 {
     _matchesServices = matchesServices;
     _playersServices = playersServices;
 }
Пример #4
0
 public MatchesController(IMatchesService matchesService, ITeamsService teamsService)
 {
     this.matchesService = matchesService;
     this.teamsService   = teamsService;
 }
 public RefereesService(FooteoDbContext dbContext, IMatchesService matchesService, ITeamLeaguesService teamLeaguesService)
 {
     this.dbContext          = dbContext;
     this.matchesService     = matchesService;
     this.teamLeaguesService = teamLeaguesService;
 }
Пример #6
0
 public MatchesController(IMatchesService matchesService)
 {
     _matchesService     = matchesService;
     _mapperToMatchModel = new MapperConfiguration(cfg => cfg.CreateMap <Match, MatchViewModel>()).CreateMapper();
     _mapperToMatch      = new MapperConfiguration(cfg => cfg.CreateMap <MatchViewModel, Match>()).CreateMapper();
 }
Пример #7
0
 public HomeController(IMatchesService matchesService)
 {
     this.matchesService = matchesService;
 }
Пример #8
0
        public MatchModule(IBootstrapInjection injection)
        {
            JsonSettings.MaxJsonLength = int.MaxValue;
            _matcheService             = injection.Services.Match;
            _matchRepository           = injection.Repositories.Match;
            Get[EndpointConfigurationEnum.GET_ALL_MATCHES] = p =>
            {
                var dtos = _matcheService.GetAll()
                           .Select(m => new MatchDTO(m));
                return(Response.AsJson(dtos));
            };

            Get[EndpointConfigurationEnum.GET_ALL_MATCHES] = p =>
            {
                var dtos = _matcheService.GetAll()
                           .Select(m => new MatchDTO(m));
                return(Response.AsJson(dtos));
            };


            Get[EndpointConfigurationEnum.GET_IMAGE_MATCH] = p =>
            {
                try
                {
                    Stream imagem = _matcheService.GetImage(p.id);
                    if (imagem == null)
                    {
                        throw new ArgumentException("Não existe");
                    }
                    return(Response.FromStream(imagem, "image/jpg"));
                }
                catch (ArgumentException)
                {
                    return(HttpStatusCode.NotFound);
                }
                catch (Exception)
                {
                    return(HttpStatusCode.InternalServerError);
                }
            };

            Get[EndpointConfigurationEnum.GET_MATCH] = p =>
            {
                var match = _matcheService.GetMatch(p.id);
                return(Response.AsJson(new MatchDTO(match)));
            };

            Put[EndpointConfigurationEnum.CHANGE_MATCH] = p =>
            {
                var matchId = p.id;
                var userId  = p.userId;
                var match   = JsonConvert.DeserializeObject <MatchDTO>(Request.Body.AsString());
                _matcheService.UpdateMatch(match.PlayersTeamWinner, match.PlayersTeamLooser, userId, matchId);
                return(HttpStatusCode.Accepted);
            };

            Post[EndpointConfigurationEnum.UPLOAD_MATCH, true] = async(x, p) =>
            {
                var bodyStream = GetImageBodyStream();
                int type       = Convert.ToInt32(x.matchType.Value);
                await _matcheService.RegisterMatchAsync(bodyStream, (MatchTypeEnum)type);

                return(HttpStatusCode.OK);
            };

            Post[EndpointConfigurationEnum.UPLOAD_MATCH_DETAILS] = x =>
            {
                var      bodyStream = GetImageBodyStream();
                int      type       = Convert.ToInt32(x.matchType.Value);
                string   dateStr    = x.dateTime.ToString();
                DateTime date       = DateTime.ParseExact(dateStr, "yyyy-MM-dd_HH-mm-ss", CultureInfo.InvariantCulture);
                var      t          = _matcheService.RegisterMatchAsync(bodyStream, (MatchTypeEnum)type, date);
                t.Wait();


                return(HttpStatusCode.OK);
            };


            Get["Import"] = p =>
            {
                var toImport = JsonConvert.DeserializeObject <List <MatchDTO> >(
                    System.IO.File.ReadAllText(
                        @"C:\users\leonardo.kobus\desktop\matches.txt"));
                toImport.ForEach(m =>
                {
                    try
                    {
                        var file   = GetImageFile(m.Date.AddHours(-3));
                        var result = Domain.Entities.Match.Factory.FromDTO(
                            m.Id, m.Date, m.PlayersTeamWinner, m.PlayersTeamLooser,
                            m.Status, m.Winners, m.Loosers, file, MatchTypeEnum.SOLO
                            );
                        _matchRepository.Upsert(result.Instance);
                    }
                    catch (Exception ex)
                    {
                        var ops = "";
                    }
                });
                return("ok");
            };
        }
Пример #9
0
 public MatchesController(IMatchesService Matches)
 {
     _matchesmanager = (MatchesManager)Matches;
 }
Пример #10
0
 public MatchesController(IMatchesService matchesService, IUserService userService, ILogger <MatchesController> logger)
 {
     _matchesService = matchesService;
     _userService    = userService;
     _logger         = logger;
 }
Пример #11
0
 public LeaguesService(ApplicationDbContext context, IMatchesService matchesService)
 {
     _context        = context;
     _matchesService = matchesService;
 }
Пример #12
0
 public MatchesController(ITeamLeaguesService teamLeaguesService, IFixturesService fixturesService,
                          IFieldsService fieldsService, IPlayersService usersService, IMatchesService matchesService)
 {
     this.teamLeaguesService = teamLeaguesService;
     this.fixturesService    = fixturesService;
     this.fieldsService      = fieldsService;
     this.usersService       = usersService;
     this.matchesService     = matchesService;
 }
Пример #13
0
 public HomeController(IStringLocalizer <HomeController> localizer, ILogger <HomeController> logger, IMatchesService matchesService)
 {
     _localizer      = localizer;
     _logger         = logger;
     _matchesService = matchesService;
 }
Пример #14
0
 public ResultsController(IMatchesService matchesService)
 {
     _matchesService = matchesService;
 }
 public MatchesController(IMatchesService matchesService, IUsersService usersService, IPredictionsService predictionsService)
 {
     this.matchesService     = matchesService;
     this.usersService       = usersService;
     this.predictionsService = predictionsService;
 }
Пример #16
0
 public TeamsStatsAggregationService(ITeamsService teamsService, IMatchesService matchesService)
 {
     _teamsService   = teamsService;
     _matchesService = matchesService;
 }
 public FixturesController(IFixturesService fixturesService, ILeaguesService leaguesService, IMatchesService matchesService)
 {
     this.fixturesService = fixturesService;
     this.leaguesService  = leaguesService;
     this.matchesService  = matchesService;
 }
Пример #18
0
 public LeagueController(ILeagueService League, ILeagueTeamService leagueTeamService, IMatchesService matchesService)
 {
     _Leaguemanager     = (LeagueManager)League;
     _leagueTeamManager = (LeagueTeamManager)leagueTeamService;
     _matchesManager    = (MatchesManager)matchesService;
 }
Пример #19
0
 public MatchesController(ApplicationDbContext context, ILeaguesService leaguesService, IMatchesService matchesService, ITeamsService teamsService)
 {
     _leaguesService = leaguesService;
     _matchesService = matchesService;
     _teamsService   = teamsService;
 }
Пример #20
0
 public MatchesController(IMatchesService matchService)
 {
     _matchService = matchService;
 }
Пример #21
0
 public MatchesController(IMatchesService matchesService, IPredictionsService predictionsService)
 {
     _matchesService = matchesService;
     _predictionsService = predictionsService;
 }
Пример #22
0
 public SeasonAdminControllers(ITeamsService teamsService, IMatchesService matchesService, ILogger <TeamsController> logger)
 {
     _teamsService   = teamsService;
     _matchesService = matchesService;
     _logger         = logger;
 }