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)); }
public bool GameOver(Guid board) { var model = boards.Get(board); return(model.Battleships.All(p => p.Status == BattleshipStatus.Sunk)); }