public ActionResult ChosenPlayer(PlayerStatViewModel viewModel)
        {
            //if (!ModelState.IsValid)
            //    return View(viewModel);

            //filter_on_playerName(viewModel.selected_playerNameIndex);

            Filter_CS cmd_strategy1 = new Filter_CS(get_svd());

            cmd_strategy1.execute(FieldDictionary.fname_playerSurname, viewModel.selected_playerNameIndex);

            UpdateAllStats_CS cmd_strategy2 = new UpdateAllStats_CS(get_svd());

            return(View("SelectPlayer", new PlayerStatViewModel(
                            new List <string>(),
                            new List <string>(),
                            new List <string>(),

                            get_seasonChoice(),
                            get_teamNameChoice(),
                            viewModel.selected_playerNameIndex,
                            //get_statsVM()
                            cmd_strategy2.execute()
                            )));
        }
        public ActionResult ApplyConstraints(PlayerStatViewModel viewModel)
        {
            UpdateConstraintsAndAllStats_CS cmd_strategy = new UpdateConstraintsAndAllStats_CS(get_svd());

            return(View("SelectPlayer", new PlayerStatViewModel(
                            new List <string>(),
                            new List <string>(),
                            new List <string>(),

                            get_seasonChoice(),
                            get_teamNameChoice(),
                            get_playerNameChoice(),
                            //get_statsVM()
                            cmd_strategy.execute(viewModel)
                            )));
        }
Esempio n. 3
0
        //public IActionResult Paginate()
        public async Task <IActionResult> PlayerList(int page, string search)
        {
            ViewBag.Name = search;
            if (page == 0)
            {
                page = 1;
            }
            int    nextpage = page + 1;
            Search next     = new Search();

            next.Name        = search;
            next.Page        = nextpage;
            ViewBag.NextPage = nextpage;
            if (page != 0)
            {
                ViewBag.PreviousPage = page - 1;
            }
            Stats          blankStats = new Stats();
            List <Players> players    = await _spaceJamDAL.GetPlayers(page, search);

            List <Stats> getStats = new List <Stats>();

            for (int i = 0; i < players.Count; i++)
            {
                int   id       = players[i].id;
                Stats statList = await _spaceJamDAL.GetStats(id);

                if (statList != null)
                {
                    getStats.Add(statList);
                }
                else
                {
                    getStats.Add(blankStats);
                }
            }
            PlayerStatViewModel playerStats = new PlayerStatViewModel();

            playerStats.players = players;
            playerStats.stats   = getStats;
            return(View(playerStats));
        }
        public ActionResult ChosenTeam(PlayerStatViewModel viewModel)
        {
            //if (!ModelState.IsValid)
            //    return View(viewModel);

            //List<string> player_idx = getplayerNameIndex(viewModel.selected_teamNameIndex);

            UpdateIndexAndFilter_CS cmd_strategy = new UpdateIndexAndFilter_CS(get_svd());
            List <string>           player_idx   = cmd_strategy.execute(FieldDictionary.fname_playerSurname, FieldDictionary.fname_teamName, viewModel.selected_teamNameIndex);



            return(View("SelectPlayer", new PlayerStatViewModel(new List <string>(),
                                                                new List <string>(),
                                                                player_idx,
                                                                get_seasonChoice(),
                                                                viewModel.selected_teamNameIndex,
                                                                null)
                        ));
        }
        public ActionResult ChosenSeason(PlayerStatViewModel viewModel)
        {
            // This no longer valid way of handling this validation as need to redirect to PlayerStat
            // [SERVER SIDE VALIDATION SHOULD BE HANDLED HERE]
            //if (!ModelState.IsValid)
            //    return View(viewModel);


            UpdateIndexAndFilter_CS cmd_strategy = new UpdateIndexAndFilter_CS(get_svd());
            List <string>           team_idx     = cmd_strategy.execute(FieldDictionary.fname_teamName, FieldDictionary.fname_season, viewModel.selected_seasonIndex);



            return(View("SelectPlayer", new PlayerStatViewModel(new List <string>(),
                                                                team_idx,
                                                                new List <string>(),
                                                                viewModel.selected_seasonIndex,
                                                                null,
                                                                null)
                        ));
        }
        public ActionResult SelectPlayer(PlayerStatViewModel viewModel)
        {
            // This shouldn't fire with the current setup as submits are routed to other action methods.

            return(View(viewModel));
        }