Ejemplo n.º 1
0
        public GameViewModel(Game game)
        {
            StartingPosition = ParseStartingPosition(game.StartingPosition);
            Moves = new int[game.Moves.Count][];

            for (int i = 0; i < game.Moves.Count; i++)
            {
                Moves[i] = new int[] { game.Moves.ElementAt(i).Row, game.Moves.ElementAt(i).Column };
            }
        }
Ejemplo n.º 2
0
        public ActionResult SubmitScore(string name, string startingPosition, string moves)
        {
            var game = new Game(name, startingPosition, moves);

            if (game.IsValid())
            {
                db.Games.Add(game);
                db.SaveChanges();
            }

            return RedirectToAction("HighScores");
        }