Ejemplo n.º 1
0
        public ActionResult Create(Team team)
        {
            if (ModelState.IsValid)
            {
                db.TeamSet.AddObject(team);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.Player1Id = new SelectList(db.PlayerSet, "Id", "Name", team.Player1Id);
            ViewBag.Player2Id = new SelectList(db.PlayerSet, "Id", "Name", team.Player2Id);
            return View(team);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TeamSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTeamSet(Team team)
 {
     base.AddObject("TeamSet", team);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new Team object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="player1Id">Initial value of the Player1Id property.</param>
 /// <param name="player2Id">Initial value of the Player2Id property.</param>
 public static Team CreateTeam(global::System.Int32 id, global::System.String name, global::System.Int32 player1Id, global::System.Int32 player2Id)
 {
     Team team = new Team();
     team.Id = id;
     team.Name = name;
     team.Player1Id = player1Id;
     team.Player2Id = player2Id;
     return team;
 }
Ejemplo n.º 4
0
 public ActionResult Edit(Team team)
 {
     if (ModelState.IsValid)
     {
         db.TeamSet.Attach(team);
         db.ObjectStateManager.ChangeObjectState(team, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.Player1Id = new SelectList(db.PlayerSet, "Id", "Name", team.Player1Id);
     ViewBag.Player2Id = new SelectList(db.PlayerSet, "Id", "Name", team.Player2Id);
     return View(team);
 }