Exemplo n.º 1
0
        public override void Set(string key, string value)
        {
            DbContextOptionsBuilder <GameOnContext> builder = new DbContextOptionsBuilder <GameOnContext>();

            _options(builder);

            key = NormalizeKey(key);
            var insertKey = CreateKey(key);

            using (GameOnContext context = new GameOnContext(builder.Options))
            {
                var adminConfiguration = context.AdminConfigurations.FirstOrDefault(x => x.Key == key);
                if (adminConfiguration != default(AdminConfiguration))
                {
                    adminConfiguration.Value = value;
                }
                else
                {
                    context.AdminConfigurations.Add(new AdminConfiguration()
                    {
                        Key   = key,
                        Value = value
                    });
                }

                context.SaveChanges();

                Data[insertKey] = value;
            }
        }
Exemplo n.º 2
0
 public MatchesController(GameOnContext gameOnContext, IMatchResultEntryService matchResultEntryService, ITeamService teamService, IMatchService matchService, IPlayerRegistrationService playerRegistrationService)
 {
     _gameOnContext             = gameOnContext;
     _matchResultEntryService   = matchResultEntryService;
     _teamService               = teamService;
     _matchService              = matchService;
     _playerRegistrationService = playerRegistrationService;
 }
Exemplo n.º 3
0
 public MatchResultEntryService(IRatingHelper ratingHelper, IRankHistoryLoggingService rankHistoryLoggingService, ITeamService teamService, ITimelineService timelineService, GameOnContext gameOnContext)
 {
     _ratingHelper = ratingHelper;
     _rankHistoryLoggingService = rankHistoryLoggingService;
     _teamService     = teamService;
     _timelineService = timelineService;
     _gameOnContext   = gameOnContext;
 }
Exemplo n.º 4
0
        public override void Load()
        {
            DbContextOptionsBuilder <GameOnContext> builder = new DbContextOptionsBuilder <GameOnContext>();

            _options(builder);

            using (GameOnContext context = new GameOnContext(builder.Options))
            {
                List <AdminConfiguration> items = context.AdminConfigurations
                                                  .AsNoTracking()
                                                  .ToList();

                foreach (AdminConfiguration item in items)
                {
                    Data.Add($"{Prefix}{item.Key}", item.Value);
                }
            }
        }
Exemplo n.º 5
0
        public override bool TryGet(string key, out string value)
        {
            DbContextOptionsBuilder <GameOnContext> builder = new DbContextOptionsBuilder <GameOnContext>();

            _options(builder);

            key = NormalizeKey(key);

            using (GameOnContext context = new GameOnContext(builder.Options))
            {
                var result = context.AdminConfigurations.AsNoTracking().FirstOrDefault(x => x.Key == key);
                if (!string.IsNullOrEmpty(result?.Value))
                {
                    value = result.Value;
                    return(true);
                }
            }

            value = string.Empty;
            return(false);
        }
Exemplo n.º 6
0
 public PlayerRegistrationService(GameOnContext gameOnContext)
 {
     _gameOnContext = gameOnContext;
 }
Exemplo n.º 7
0
 public MatchService(GameOnContext gameOnContext)
 {
     _gameOnContext = gameOnContext;
 }
Exemplo n.º 8
0
 public TeamService(GameOnContext gameOnContext)
 {
     _gameOnContext = gameOnContext;
 }
Exemplo n.º 9
0
 public RankHistoryLoggingService(GameOnContext gameOnContext)
 {
     _gameOnContext = gameOnContext;
 }