Exemplo n.º 1
0
        public string GetUpdatePayload(string uniqueId, int seasonWeekId, string update)
        {
            var payload = new Payload();

            PlayerStatsController playerStatsController = new PlayerStatsController();
            PositionLimitsController positionLimitsController = new PositionLimitsController();
            OwnersController ownerController = new OwnersController();
            OwnerTeamsController ownerTeamsController = new OwnerTeamsController();
            WeeksController weeksController = new WeeksController();
            GamesController gamesController = new GamesController();
            PlayersController playersController = new PlayersController();
            RanksController ranksController = new RanksController();

            var ownerExists = context.Owners.Where(o => o.UniqueId == uniqueId).First();

            var seasonWeek = new SeasonWeeks();
            if (seasonWeekId == -1)
            {
                seasonWeek = weeksController.GetSeasonWeek(DateTime.Now.ToShortDateString());
            }
            else
            {
                seasonWeek = weeksController.GetSeasonWeek(seasonWeekId);
            }

            GetPayloadCurrentOwner(payload, playerStatsController, ownerController, ownerTeamsController, playersController, seasonWeek, uniqueId);

            GetPayloadOwners(payload, playerStatsController, ownerController, ownerTeamsController, playersController, seasonWeek);

            //GetPayloadPositionLimits(payload, positionLimitsController);

            //GetPayloadWeeks(payload, weeksController);

            GetPayloadGames(payload, gamesController, seasonWeek);

            //GetPayloadPlayers(payload, playersController, ownerExists);

            GetPayloadRanks(payload, ranksController, seasonWeek);

            return Compression.Compress(JsonConvert.SerializeObject(payload));
        }
Exemplo n.º 2
0
 private static void GetPayloadPositionLimits(Payload payload, PositionLimitsController positionLimitsController)
 {
     payload.PositionLimits = positionLimitsController.GetPositionLimits();
 }
Exemplo n.º 3
0
        public string GetPositionLimitsPayload(string uniqueId, int seasonWeekId, string positionLimits)
        {
            var payload = new Payload();

            PositionLimitsController positionLimitsController = new PositionLimitsController();
            WeeksController weeksController = new WeeksController();

            var ownerExists = context.Owners.Where(o => o.UniqueId == uniqueId).First();

            var seasonWeek = new SeasonWeeks();
            if (seasonWeekId == -1)
            {
                seasonWeek = weeksController.GetSeasonWeek(DateTime.Now.ToShortDateString());
            }
            else
            {
                seasonWeek = weeksController.GetSeasonWeek(seasonWeekId);
            }

            GetPayloadPositionLimits(payload, positionLimitsController);

            return Compression.Compress(JsonConvert.SerializeObject(payload));
        }