public ActionResult Create(Player player)
        {
            if (ModelState.IsValid)
            {
                db.Players.AddObject(player);
                db.SaveChanges();
                return PartialView("GridData", new Player[] { player });
            }

            return PartialView("Edit", player);
        }
        public ActionResult Edit(Player player)
        {
            if (ModelState.IsValid)
            {
                db.Players.Attach(player);
                db.ObjectStateManager.ChangeObjectState(player, EntityState.Modified);
                db.SaveChanges();
                return PartialView("GridData", new Player[] { player });
            }

            return PartialView(player);
        }
예제 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Players EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPlayers(Player player)
 {
     base.AddObject("Players", player);
 }
예제 #4
0
 /// <summary>
 /// Create a new Player object.
 /// </summary>
 /// <param name="playerID">Initial value of the PlayerID property.</param>
 public static Player CreatePlayer(global::System.Int32 playerID)
 {
     Player player = new Player();
     player.PlayerID = playerID;
     return player;
 }