public JsonResult SolveSudoku(int?[,] input) { try { if (null != input) { var solvedSudoku = SudokuService.GetSolvedSudoku(input); return(new JsonResult(solvedSudoku)); } return(new JsonResult("no data was provided")); } catch (Exception e) { // Log the exception using any kind of logger return(new JsonResult("please enter correct data")); } }
/// <summary> /// Inicializa una nueva instancia de la clase <see cref="MainViewModel"/> /// </summary> /// <param name="navigationService">El servicio de navegación</param> /// <param name="sudokuService">El servicio de la API REST de Sudokus</param> /// <param name="messagingService">El servicio de mensajería</param> public MainViewModel( INavigationService navigationService, SudokuService sudokuService, MessagingService messagingService) { this.navigationService = navigationService; this.sudokuService = sudokuService; this.messagingService = messagingService; NewGameCommand = new RelayCommand(NewGame, () => PlayingGame && !Thinking); PlayGameCommand = new RelayCommand(PlayGame, () => !PlayingGame && !Thinking); VerifyValidGameCommand = new RelayCommand(VerifyValidGame, () => PlayingGame && !Thinking); ShowHelpCommand = new RelayCommand(ShowHelp); cells = new Cell[9][]; for (int row = 0; row < 9; row++) { cells[row] = new Cell[9]; for (int column = 0; column < 9; column++) { cells[row][column] = new Cell(); } } }
public void Setup() { _service = new SudokuService(); }
public HomeController(SudokuService sudokuService) { this.sudokuService = sudokuService; }
public IndexModel(SudokuService sudokuService) { sudoku = sudokuService; }