// // GET: /Game/Create public ActionResult Create() { GamingSessionService GamingSessionService = new GamingSessionService(); ViewBag.PlayerHomeTeamList = GamingSessionService.getPlayerTeamSelectList(Game.HOME); ViewBag.PlayerAwayTeamList = GamingSessionService.getPlayerTeamSelectList(Game.AWAY); Game defaultGame = new Game(); defaultGame.HomeGoals = 0; defaultGame.AwayGoals = 0; return View(defaultGame); }
public ActionResult Create(Game game) { if (ModelState.IsValid) { db.Games.Add(game); db.SaveChanges(); return RedirectToAction("Index"); } GamingSessionService GamingSessionService = new GamingSessionService(); return View(game); }
public ActionResult Edit(Game game) { if (ModelState.IsValid) { db.Entry(game).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(game); }