Beispiel #1
0
        public IActionResult Get(Guid board)
        {
            var model = boards.Get(board);

            if (model == null)
            {
                ModelState.AddModelError(nameof(board), $"Could not find board {board}");
                return(BadRequest(ModelState));
            }
            return(Ok(model));
        }
 public Battleship Get(Guid board, Guid battleship)
 {
     return(boards.Get(board)
            ?.Battleships
            .FirstOrDefault(p => p.Id == battleship));
 }
Beispiel #3
0
        public bool GameOver(Guid board)
        {
            var model = boards.Get(board);

            return(model.Battleships.All(p => p.Status == BattleshipStatus.Sunk));
        }