public ActionResult TeamsInSpecificLeagueResult(int leagueID)
        {
            var ops = new BaseballOperations();
            var teamsInLeague = ops.GetTeamsByLeagueID(leagueID);

            return View("LeagueTeams", teamsInLeague.League);
        }
        public ActionResult ConfirmDeletePlayer(int playerid)
        {
            var ops = new BaseballOperations();

            ops.RemovePlayerByID(playerid);
            var playerResponse = ops.GetPlayerByID(playerid);

            return View("ConfirmDeletePlayer", playerResponse.Player);
        }
        //Lara created --- goes to list of Teams page
        public ActionResult Index()
        {
            var ops = new BaseballOperations();
            AddPlayerViewModel teams = new AddPlayerViewModel();

            var response = ops.GetAllTeams();

            return View("Index",response.Teams);
        }
        //Response response = new Response();
        // GET: Home
        public ActionResult Index()
        {
            var ops = new BaseballOperations();
            var response = ops.GetAllLeagues();

            //var leagueVM = new LeagueVM();

            //leagueVM.CreateLeagueList(response.Leagues);

            return View("Index", response.Leagues);
        }
        //******************************************************************
        public ActionResult AddTeam()
        {
            BaseballOperations ops = new BaseballOperations();

            TeamVM tvm = new TeamVM();

            var response = ops.GetAllLeagues();
            tvm.CreateLeagueList(response.Leagues);

            return View(tvm);
        }
        // GET: Player
        public ActionResult AddPlayer()
        {
            BaseballOperations ops = new BaseballOperations();

            AddPlayerViewModel addP = new AddPlayerViewModel();

            var teamResponse = ops.GetAllTeams();
            var positionResponse = ops.GetAllPositions();

            addP.CreatePositionList(positionResponse.Positions);
            addP.CreateTeamList(teamResponse.Teams);

            return View(addP);
        }
        public ActionResult AddTeam(TeamVM vm)
        {
            var ops = new BaseballOperations();

            var response = ops.GetAllLeagues();
            vm.CreateLeagueList(response.Leagues);

            if (ModelState.IsValid)
            {
                var opsResponse = ops.AddTeam(vm.Team);
                opsResponse.Team.League = ops.GetLeagueByID(vm.Team.League.LeagueID).League;
                return View("TeamDetails", opsResponse.Team);
            }
            else
            {
                return View("AddTeam");
            }
        }
        public ActionResult AddPlayer(AddPlayerViewModel addP)
        {
            var ops = new BaseballOperations();

            var teamResponse = ops.GetAllTeams();
            var positionResponse = ops.GetAllPositions();

            addP.CreateTeamList(teamResponse.Teams);
            addP.CreatePositionList(positionResponse.Positions);

            if (ModelState.IsValid)
            {
                var playerResponse = ops.CreatePlayer(addP.player);
                playerResponse.Player.Position =
                    ops.GetAllPositions().Positions.FirstOrDefault(p => p.PositionID == addP.player.Position.PositionID);

                return View("PlayerDetails", playerResponse.Player);
            }
            else
            {
                return View(addP);
            }
        }
 public void SetUp()
 {
     _ops = new BaseballOperations();
     _response = new Response();
     _jss = new JavaScriptSerializer();
 }
        //Lara added -- goes to list of players page
        public ActionResult Index(int teamID)
        {
            TeamPlayersVM vm = new TeamPlayersVM();
            BaseballOperations ops = new BaseballOperations();
            AddPlayerViewModel teams = new AddPlayerViewModel();

            var response = ops.GetPlayersByTeamName(teamID);
            vm.TeamName = ops.GetTeamByID(teamID).Team.TeamName;
            vm.Players = response.Players;

            return View(vm);
        }