示例#1
0
 public ActionResult GetTeamsToTrade(GetTeamsForTradeVM vm)
 {
     var teamManager = new TeamManager();
     var playerManager = new PlayerManager();
     var newvm = new TradeVM();
     newvm.Team1 = teamManager.GetTeamById(vm.Team1ID);
     newvm.Team2 = teamManager.GetTeamById(vm.Team2ID);
     var team1players = playerManager.GetAllPlayers().FindAll(p => p.TeamId == newvm.Team1.Id);
     var team2players = playerManager.GetAllPlayers().FindAll(p => p.TeamId == newvm.Team2.Id);
     newvm.SetTeam1List(team1players);
     newvm.SetTeam2List(team2players);
     return View("TradePlayers", newvm);
 }
示例#2
0
 public ActionResult GetTeamsToTrade()
 {
     var teamManager = new TeamManager();
     var vm = new GetTeamsForTradeVM();
     var teams = teamManager.GetAllTeams().ToList();
     teams.RemoveAll(t => t.Players == null || t.Players.Count == 0);
     teams.RemoveAll(t => t.Id == 0);
     vm.SetTeam1List(teams);
     vm.SetTeam2List(teams);
     return View(vm);
 }