示例#1
0
        //
        // 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);
        }
示例#2
0
        public ActionResult Create(Game game)
        {
            if (ModelState.IsValid)
            {
                db.Games.Add(game);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            GamingSessionService GamingSessionService = new GamingSessionService();

            return View(game);
        }
示例#3
0
 public ActionResult Edit(Game game)
 {
     if (ModelState.IsValid)
     {
         db.Entry(game).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(game);
 }