Example #1
0
 public ActionResult AddLeaguelessTeamtoLeague(int id)
 {
     var teamManager = new TeamManager();
     var leagueManager = new LeagueManager();
     var vm = new AddNoLeagueTeamToLeagueVM();
     vm.LeagueToAddTeam = leagueManager.GetLeagueById(id);
     vm.LeagueToRemoveTeam = leagueManager.GetLeagueById(0);
     var teams1 = teamManager.GetAllTeams().FindAll(t => t.LeagueId == 0);
     teams1.RemoveAll(t => t.Id == 0);
     var teams2 = teamManager.GetAllTeams().FindAll(t => t.LeagueId == id);
     vm.SetLeaguelessTeams(teams1);
     vm.SetTeamsInLeague(teams2);
     return View(vm);
 }
Example #2
0
        public ActionResult ViewRoster(int id)
        {
            var leagueManager = new LeagueManager();
            var manager = new TeamManager();
            var roster = manager.GetTeamById(id);

            var teamVM = new TeamVM();
            teamVM.Team = roster;
            teamVM.TeamLeague = leagueManager.GetLeagueById(teamVM.Team.LeagueId);
            teamVM.FreeAgents = manager.GetTeamById(0);
            teamVM.Team.Players = roster.Players.OrderBy(t => t.LastName).ToList();

            return View(teamVM);
        }
Example #3
0
        public ActionResult EditLeague(int id)
        {
            var manager = new LeagueManager();
            League league = new League();
            league.Id = id;
            var editLeague = manager.GetLeagueById(league.Id);

            return View(editLeague);
        }
Example #4
0
 public ActionResult ViewLeague(int id)
 {
     var leagueManager = new LeagueManager();
     var manager = new TeamManager();
     var league = leagueManager.GetLeagueById(id);
     var leagueVM = new LeagueVM();
     leagueVM.League = league;
     leagueVM.TeamsInLeague = manager.GetAllTeams().FindAll(t => t.LeagueId == leagueVM.League.Id);
     return View(leagueVM);
 }
Example #5
0
        public ActionResult DeleteLeague(int id)
        {
            var manager = new LeagueManager();
            var league = manager.GetLeagueById(id);

            return View(league);
        }