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 }; } }
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"); }