public ActionResult DetailsTeam(TeamDetailsMvcModel model, string listOfTeamMembers) { TeamModel t = new TeamModel(); List <ApplicationUser> teamMembers = new List <ApplicationUser>(); //Assign TeamName and Id from TeamDetailsMVCModel to TeamModel t.TeamName = model.Team.TeamName; t.Id = model.Team.Id; string[] split = listOfTeamMembers.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); List <string> split2 = new List <string>(); int i = 0; //Remove special characters from each team member ID (except "-") foreach (string element in split) { split2.Add(Regex.Replace(element, "[^0-9a-zA-Z-]+", "")); i++; } //Get each team member from database into teammodel foreach (string element in split2) { teamMembers.Add(GlobalConfiguration.Connection.GetPlayerById(element)); } t.TeamMembers = teamMembers; GlobalConfiguration.Connection.EditTeam(t); //GlobalConfiguration.Connection.EditTeam(t); return(RedirectToAction("Index")); }
// GET: Team public ActionResult DetailsTeam(int id) { //TeamModel team = GlobalConfiguration.Connection.GetTeam(Id); //List<ApplicationUser> availablePlayers = GlobalConfiguration.Connection.Players_GetAvailable(); TeamDetailsMvcModel model = new TeamDetailsMvcModel { Team = GlobalConfiguration.Connection.GetTeam(id), AvailablePlayers = GlobalConfiguration.Connection.Players_GetAvailable() }; var tournamentId = GlobalConfiguration.Connection.Team_InTournament(id); if (tournamentId > 0) { model.InTournament = true; } else { model.InTournament = false; } return(View(model)); }