public ActionResult Create(Coach coach) { if (ModelState.IsValid) { db.Coaches.AddObject(coach); db.SaveChanges(); return PartialView("GridData", new Coach[] { coach }); } return PartialView("Edit", coach); }
/// <summary> /// Create a new Coach object. /// </summary> /// <param name="coachID">Initial value of the CoachID property.</param> /// <param name="coachNames">Initial value of the CoachNames property.</param> public static Coach CreateCoach(global::System.Int32 coachID, global::System.String coachNames) { Coach coach = new Coach(); coach.CoachID = coachID; coach.CoachNames = coachNames; return coach; }
/// <summary> /// Deprecated Method for adding a new object to the Coaches EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCoaches(Coach coach) { base.AddObject("Coaches", coach); }
public ActionResult Edit(Coach coach) { if (ModelState.IsValid) { db.Coaches.Attach(coach); db.ObjectStateManager.ChangeObjectState(coach, EntityState.Modified); db.SaveChanges(); return PartialView("GridData", new Coach[] { coach }); } return PartialView(coach); }