예제 #1
0
        /// <summary>
        /// TODO - This could/should be in his own class - NhlApiServices. ...2 methods. UpdatePastPlayer(), UpdatePlayer()
        /// </summary>
        public void UpDbSeason()
        {
            foreach (var team in Teams.Season)
            {
                var playerInfoEntities = GetNhlApiTeamPlayersInfo(team);

                if (playerInfoEntities == null)
                {
                    LogError.Write(new Exception("Error"), "Fail while parsing deserialize NHl aPi Data, playerInfoEntities == null, for team:" + team);
                    return;
                }
                if (!playerInfoEntities.Any())
                {
                    continue;
                }

                _pastPlayerInfoServices.Create(playerInfoEntities);
                _playerInfoServices.Update(playerInfoEntities);
            }
        }
예제 #2
0
        /// <summary>
        /// Past Player Info Filler. Run daily with data from MySportsFeeds Api.
        /// Now sperated from other rtoutine, 1st cuz of speration of concerns, 2 the main routine now run every 2 hours, 3 will make the main routine lighter ( -lt 5 min)
        /// </summary>
        /// <returns></returns>
        public ActionResult DailyPastStatsFiller()
        {
            Caching.ClearAllCaches();
            var timer = Stopwatch.StartNew();
            var api   = new MySportsFeedApiTransactions();
            var data  = api.SplitDataTeamLists();

            // Update PastPlayerInfo table team per team
            foreach (var playerInfoList in data)
            {
                _pastPlayerInfoServices.Create(playerInfoList);
            }

            Caching.ClearAllCaches();
            // for DEBUG only
            //Debug.WriteLine("DailyPastStatsFiller time: " + timer.Elapsed);
            // For PROD only
            SendMessage("DailyPastStatsFiller", "Success", timer.Elapsed.ToString()); // fail will be sent by LogError
            return(RedirectToAction("Index", "Home", new { Area = "Common" }));
        }