Ejemplo n.º 1
0
        public ActionResult RemoveTeamToLeagueless(RemoveTeamToNoLeagueVM vm)
        {
            var teamManager = new TeamManager();

            if (vm.TeamsToAdd != null && vm.TeamsToAdd.Count > 0)
            {
                foreach (var teamid in vm.TeamsToAdd)
                {
                    var team = teamManager.GetTeamById(teamid);
                    team.LeagueId = vm.Leagueless.Id;
                }
            }
            return RedirectToAction("RemoveTeamToLeagueless");
        }
Ejemplo n.º 2
0
 public ActionResult RemoveTeamToLeagueless(int id)
 {
     var teamManager = new TeamManager();
     var leagueManager = new LeagueManager();
     var vm = new RemoveTeamToNoLeagueVM();
     vm.Leagueless = leagueManager.GetLeagueById(0);
     vm.LeagueToRemoveTeam = leagueManager.GetLeagueById(id);
     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);
 }