Exemplo n.º 1
0
 public ActionResult UpdateTeam(int id , Team updatedTeam)
 {
     Team teamToUpdate = ctx.Teams.Find(id);
     teamToUpdate.Name = updatedTeam.Name;
     teamToUpdate.Location = updatedTeam.Location;
     teamToUpdate.HeadCoach = updatedTeam.HeadCoach;
     teamToUpdate.FoundingYear = updatedTeam.FoundingYear;
     ctx.SaveChanges();
     return RedirectToAction("Index");
 }
Exemplo n.º 2
0
        public ActionResult Index(Team team)
        {
            ctx.Teams.Add(team);
            ctx.SaveChanges();

            model.Players = ctx.Palyers.ToList();
            model.Teams = ctx.Teams.ToList();
            model.Departments = ctx.Departments.Where(d => d.Players.Any(p => p.Salary >= 200000)).ToList();

            return View(model);
        }