Exemple #1
0
        public IActionResult Post([FromBody] SudokuPuzzleModel sudokuPuzzle)
        {
            var    puzzleMapper       = new SudokuPuzzleMapper();
            Puzzle internalPuzzle     = puzzleMapper.ConvertApiModelToInternalModel(sudokuPuzzle);
            var    puzzleSolver       = new PuzzleSolver(internalPuzzle);
            var    completedValidator = new PuzzleCompletedValidator(internalPuzzle);


            var response = new ValidatedPuzzleResponse()
            {
                Valid  = puzzleSolver.PuzzleIsValid(),
                Solved = puzzleSolver.PuzzleIsValid() && completedValidator.PuzzleIsCompleted()
            };

            return(Ok(response));
        }