public ActionResult Create(FootballMatch footballmatch) { if (ModelState.IsValid) { db.FootballMatches.AddObject(footballmatch); db.SaveChanges(); return PartialView("GridData", new FootballMatch[] { footballmatch }); } ViewBag.TeamA = new SelectList(db.Teams, "TeamID", "Name", footballmatch.TeamA); ViewBag.TeamB = new SelectList(db.Teams, "TeamID", "Name", footballmatch.TeamB); ViewBag.TournamentID = new SelectList(db.Tournaments, "TournamentID", "Name", footballmatch.TournamentID); return PartialView("Edit", footballmatch); }
/// <summary> /// Deprecated Method for adding a new object to the FootballMatches EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToFootballMatches(FootballMatch footballMatch) { base.AddObject("FootballMatches", footballMatch); }
/// <summary> /// Create a new FootballMatch object. /// </summary> /// <param name="matchID">Initial value of the MatchID property.</param> /// <param name="tournamentID">Initial value of the TournamentID property.</param> /// <param name="teamA">Initial value of the TeamA property.</param> /// <param name="teamB">Initial value of the TeamB property.</param> /// <param name="finalScore">Initial value of the FinalScore property.</param> /// <param name="matchDate">Initial value of the MatchDate property.</param> public static FootballMatch CreateFootballMatch(global::System.Int32 matchID, global::System.Int32 tournamentID, global::System.Int32 teamA, global::System.Int32 teamB, global::System.String finalScore, global::System.DateTime matchDate) { FootballMatch footballMatch = new FootballMatch(); footballMatch.MatchID = matchID; footballMatch.TournamentID = tournamentID; footballMatch.TeamA = teamA; footballMatch.TeamB = teamB; footballMatch.FinalScore = finalScore; footballMatch.MatchDate = matchDate; return footballMatch; }
public ActionResult Edit(FootballMatch footballmatch) { if (ModelState.IsValid) { db.FootballMatches.Attach(footballmatch); db.ObjectStateManager.ChangeObjectState(footballmatch, EntityState.Modified); db.SaveChanges(); return PartialView("GridData", new FootballMatch[] { footballmatch }); } ViewBag.TeamA = new SelectList(db.Teams, "TeamID", "Name", footballmatch.TeamA); ViewBag.TeamB = new SelectList(db.Teams, "TeamID", "Name", footballmatch.TeamB); ViewBag.TournamentID = new SelectList(db.Tournaments, "TournamentID", "Name", footballmatch.TournamentID); return PartialView(footballmatch); }