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); }
/// <summary> /// Deprecated Method for adding a new object to the Players EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPlayers(Player player) { base.AddObject("Players", player); }
/// <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; }