public ActionResult EditTeam(string currentTeamName) { var viewModel = new TeamsVM(); viewModel.Team = _league.GetAllTeams().ResponseType.FirstOrDefault(t => t.Name == currentTeamName); viewModel.SetPlayers(_league.GetAllPlayersForTeam(viewModel.Team.Name).ResponseType); return(View(viewModel)); }
public ActionResult EditTeam(TeamsVM viewModel) { if (ModelState.IsValid) { _league.EditTeam(viewModel.Team); return(RedirectToAction("GetAllTeams")); } viewModel.SetPlayers(_league.GetAllPlayersForTeam(viewModel.Team.Name).ResponseType); return(View(viewModel)); }