Пример #1
0
        public ActionResult Stage3()
        {
            if (GetGameStage() != GameStage.SecondDone)
            {
                return(RedirectToAction("Stage2"));
            }

            var playerId   = Request.Cookies.Get("PlayerId").Value;
            var playerGuid = new Guid(playerId);
            var player     = db.Players.First(x => x.UniqueId == playerGuid);
            var stage      = new Stage3Model()
            {
                UserId   = new Guid(playerId),
                TaskText = player.EinteinsAnswer.ToString(),
            };

            return(View(stage));
        }
Пример #2
0
        public ActionResult Stage3([Bind(Include = "Answer")] Stage3Model stage)
        {
            //This done nothing
            if (stage == null)
            {
                return(View(stage));
            }
            var playerId   = Request.Cookies.Get("PlayerId").Value;
            var playerGuid = new Guid(playerId);
            var player     = db.Players.First(x => x.UniqueId == playerGuid);

            player.GameStage    = GameStage.Finished;
            player.Stage3Answer = stage.Answer;
            player.EndTime      = DateTime.Now;
            db.SaveChanges();

            return(RedirectToAction("Stage3"));
        }