Beispiel #1
0
 public JsonResult SaveCellValue(int rowIndex, int columnIndex, int value)
 {
     return(new JsonResult(
                new
     {
         isErrorValue = _sudokuService.SetCellValue(rowIndex, columnIndex, value),
         isLevelCompleted = _sudokuService.CheckGameCompleted()
     }
                ));
 }
 public Candidate Post([FromBody] Candidate cellCandidate)
 {
     if (_sudokuService.SetCellValue(cellCandidate.Value, cellCandidate.RowNumber, cellCandidate.ColumnNumber))
     {
         _sudokuHubContext.Clients.All.SendAsync("send", cellCandidate);
         if (_sudokuService.IsGameOver())
         {
             // TODO: выслать победившего пользователя, обновить рейтинг
             _sudokuHubContext.Clients.All.SendAsync("send", "Game Over!");
         }
         return(cellCandidate);
     }
     else
     {
         return(null);
     }
 }