public ActionResult Create()
        {
            ViewBag.AwayTeamId = new SelectList(db.TeamSet, "Id", "Name");
            ViewBag.HomeTeamId = new SelectList(db.TeamSet, "Id", "Name");

            int defaultSeasonId = GetDefaultSeasonId();
            ViewBag.SeasonId = new SelectList(db.SeasonSet, "Id", "Name", defaultSeasonId);

            var newMatch = new Match { DateTime = DateTime.Now };

            return View(newMatch);
        }
        public ActionResult Create(Match match)
        {
            if (ModelState.IsValid)
            {
                db.MatchSet.AddObject(match);
                db.SaveChanges();
                seasonTableController.CreateTableForSeasonBasedOnId(match.SeasonId);
                return RedirectToAction("Index");
            }

            ViewBag.AwayTeamId = new SelectList(db.TeamSet, "Id", "Name", match.AwayTeamId);
            ViewBag.HomeTeamId = new SelectList(db.TeamSet, "Id", "Name", match.HomeTeamId);
            ViewBag.SeasonId = new SelectList(db.SeasonSet, "Id", "Name", match.SeasonId);
            return View(match);
        }
 /// <summary>
 /// Create a new Match object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="homeGoals">Initial value of the HomeGoals property.</param>
 /// <param name="awayGoals">Initial value of the AwayGoals property.</param>
 /// <param name="awayTeamId">Initial value of the AwayTeamId property.</param>
 /// <param name="homeTeamId">Initial value of the HomeTeamId property.</param>
 /// <param name="dateTime">Initial value of the DateTime property.</param>
 /// <param name="seasonId">Initial value of the SeasonId property.</param>
 public static Match CreateMatch(global::System.Int32 id, global::System.Int32 homeGoals, global::System.Int32 awayGoals, global::System.Int32 awayTeamId, global::System.Int32 homeTeamId, global::System.DateTime dateTime, global::System.Int32 seasonId)
 {
     Match match = new Match();
     match.Id = id;
     match.HomeGoals = homeGoals;
     match.AwayGoals = awayGoals;
     match.AwayTeamId = awayTeamId;
     match.HomeTeamId = homeTeamId;
     match.DateTime = dateTime;
     match.SeasonId = seasonId;
     return match;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the MatchSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMatchSet(Match match)
 {
     base.AddObject("MatchSet", match);
 }