public void UpdateEnemyShips(List <List <ShipPoint> > ships) { foreach (var dataShip in ships) { var shipEntity = _shipRepo.GetById(dataShip[0].ShipId); foreach (var piece in shipEntity.ShipPieces) { var dataPiece = dataShip.FirstOrDefault(sp => sp.ShipPieceId == piece.Id); piece.IsHit = dataPiece.Hit; piece.IsMissed = dataPiece.Missed; } _shipRepo.UpdateShip(shipEntity); } }