public ActionResult Create(Team team) { if (ModelState.IsValid) { db.Teams.AddObject(team); db.SaveChanges(); return PartialView("GridData", new Team[] { team }); } ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "Name", team.CountryID); return PartialView("Edit", team); }
/// <summary> /// Deprecated Method for adding a new object to the Teams EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTeams(Team team) { base.AddObject("Teams", team); }
/// <summary> /// Create a new Team object. /// </summary> /// <param name="teamID">Initial value of the TeamID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="countryID">Initial value of the CountryID property.</param> public static Team CreateTeam(global::System.Int32 teamID, global::System.String name, global::System.Int32 countryID) { Team team = new Team(); team.TeamID = teamID; team.Name = name; team.CountryID = countryID; return team; }
public ActionResult Edit(Team team) { if (ModelState.IsValid) { db.Teams.Attach(team); db.ObjectStateManager.ChangeObjectState(team, EntityState.Modified); db.SaveChanges(); return PartialView("GridData", new Team[] { team }); } ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "Name", team.CountryID); return PartialView(team); }