Пример #1
0
        public ActionResult MatchResults(TournamentGameResult model)
        {
            var game = db.Games.Find(model.GameId);

            if (ModelState.IsValid)
            {
                game.Team1Score = model.Team1Score;
                game.Team2Score = model.Team2Score;
                game.Status = GameStatus.Played;

                db.Entry(game).State = EntityState.Modified;
                db.SaveChanges();

                return RedirectToAction("Details", new { id = model.TournamentId, skazzy = 1 });
            }

            model.Team1Name = game.Team1.Name;
            model.Team2Name = game.Team2.Name;

            return View(model);
        }
Пример #2
0
        //
        // GET: /Tournament/MatchResults
        public ActionResult MatchResults(int id, int tournamentId)
        {
            var model = new TournamentGameResult();
            model.GameId = id;
            model.TournamentId = tournamentId;

            var game = db.Games.Find(id);
            model.Team1Score = game.Team1Score;
            model.Team2Score = game.Team2Score;
            model.Team1Name = game.Team1.Name;
            model.Team2Name = game.Team2.Name;

            return View(model);
        }