public ActionResult Edit(Player player, String teamList)
 {
     var teamId = Convert.ToInt32(teamList);
     if (ModelState.IsValid)
     {
         using (var context = new FootballManagerDBContext())
         {
             Team team = context.Teams.Single(selectedTeam => selectedTeam.ID == teamId);
             player.TeamId = teamId;
             player.Team = team;
             context.Entry(player).State = EntityState.Modified;
             context.SaveChanges();
         }
         return RedirectToAction("IndexList");
     }
     return View(player);
 }
예제 #2
0
 public ActionResult Edit(Team team)
 {
     if (ModelState.IsValid)
     {
         using (var context = new FootballManagerDBContext())
         {
             context.Entry(team).State = EntityState.Modified;
             context.SaveChanges();
         }
         return RedirectToAction("Index");
     }
     return View(team);
 }