Exemple #1
0
        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));
        }
Exemple #2
0
 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));
 }