public ActionResult MoveToLeague(int[] teams, int leagueId, int seasonId) { var vm = new MoveTeamToLeagueViewModel(); var currentUnionId = leagueRepo.GetById(leagueId).UnionId; if (currentUnionId.HasValue) { var leagues = leagueRepo.GetLeaguesForMoveByUnionSeasonId(currentUnionId.Value, seasonId, leagueId); vm.Leagues = leagues.Select(x => new SelectListItem { Text = x.Name, Value = x.LeagueId.ToString() }).ToList(); if (leagues.Count > 0) { vm.LeagueId = leagues.Last().LeagueId; } } vm.CurrentLeagueId = leagueId; vm.TeamIds = teams; vm.SeasonId = seasonId; return(PartialView("_MoveTeamToLeaguePartial", vm)); }
public ActionResult MoveTeams(MoveTeamToLeagueViewModel model) { teamRepo.MoveTeams(model.LeagueId, model.TeamIds, model.CurrentLeagueId, model.SeasonId); return(Redirect(Request.UrlReferrer.ToString())); }