Exemplo n.º 1
0
        public IActionResult Index()
        {
            IEnumerable <Product> list = _services.GetAll();
            GetDataViewModel      vm   = new GetDataViewModel
            {
                List  = list,
                Time  = DateTime.Now,
                Total = list.Count()
            };

            return(View(vm));
        }
        public List <GetDataViewModel> GetDataViewModels(string Cnn, string TbName, string PrimaryKey)
        {
            List <SyncTable> SyncTable = GetRecordFromSyncTable(Cnn, TbName);

            DataTable Records = GetRecordFromTable(Cnn, TbName, SyncTable, PrimaryKey);

            List <GetDataViewModel> DataSync = new List <GetDataViewModel>();



            //DataRow dr = Records.NewRow();

            //dr = Records.Select(PrimaryKey + "=2712")[0];
            //var dddd = JsonConvert.SerializeObject(dr);


            foreach (var item in SyncTable.OrderBy(f => f.CreateDate))
            {
                GetDataViewModel d = new GetDataViewModel()
                {
                    DataUp     = Records.Select(PrimaryKey + "=" + item.TableID).CopyToDataTable(),
                    CreateDate = item.CreateDate,
                    StatusID   = (StatusEnum)item.StatusID,
                    TableName  = TbName
                };

                DataSync.Add(d);
                var ds = Records.Select(PrimaryKey + "=" + item.TableID);
            }


            var dddd = JsonConvert.SerializeObject(DataSync);

            //foreach (var item in SyncTable)
            //{
            //    labsSync.Add(
            //        new GetDataViewModel()
            //        {
            //            lab = AllLabs.Where(f => f.LabID == item.TableID).FirstOrDefault(),
            //            CreateDate = item.CreateDate,
            //            StatusID = (StatusEnum)item.StatusID
            //        }
            //        );


            //    //labsSync.Add(AllLabs.Where(f => f.LabID == item.TableID). .FirstOrDefault());
            //}
            return(DataSync);
        }
Exemplo n.º 3
0
        public IActionResult Index(GetDataViewModel getDataViewModel)
        {
            var gameLogic = new GameLogic(_context);

            DateTime yesterday = DateTime.Today.Date.AddDays(-1);
            var      date      = yesterday.Date;
            var      year      = date.ToString("yyyy");
            var      month     = date.ToString("MM");
            var      day       = date.ToString("dd");


            string strJson = "http://statsapi.mlb.com/api/v1/schedule?sportId=1&date=" + month + "/" + day + "/" + year;

            //string strJson = "http://statsapi.mlb.com/api/v1/schedule?sportId=1&date=03/28/2019";

            //This gets the List of Game URLS for that day.

            //List<Game> gameUrls = gameLogic.UpdateYesterdayGames(strJson, yesterday);

            //foreach (Game game in gameUrls)
            //{
            //    gameLogic.GetBatterData(game);
            //    gameLogic.GetPitcherData(game);
            //}

            foreach (var game in _context.TopGames)
            {
                var player = _context.Batters.Where(p => p.PlayerID == game.PlayerID).FirstOrDefault();;

                game.PlayerName = player.FirstName + " " + player.LastName;
            }
            _context.SaveChanges();
            //gameLogic.TopGameData(yesterday);



            //gameLogic.UpdateRecentGames();
            return(Redirect("GetData/Test"));
        }
Exemplo n.º 4
0
 public GetDataView(IGameRestClient gameRestClient)
 {
     InitializeComponent();
     DataContext = new GetDataViewModel(gameRestClient);
 }