Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
        //
        // GET: /GaminSession/Edit/5
        public ActionResult Edit(int id = 0)
        {
            GamingSession GamingSession = db.GamingSessions.Find(id);
            GamingSessionViewModel GamingSessionViewModel = new GamingSessionViewModel();
            GamingSessionViewModel.GamingSession = GamingSession;

            GamingSessionService GamingSessionService = new GamingSessionService();

            if (GamingSession == null)
            {
                return HttpNotFound();
            }

            //Add viewbags

            return View(GamingSessionViewModel);
        }