Exemplo n.º 1
0
        /// <summary>
        /// Check Board capacity of ships
        /// </summary>
        private bool InvalidCapacity(Ship ship)
        {
            if (Ships.Count == ShipCapacity)
            {
                Log.Write($"You have the maximum number of ships:({ShipCapacity})!");
                return(true);
            }

            if (ship.Type == ShipType.Battleship)
            {
                if (Ships.Count(s => s.Type == ShipType.Battleship) == 1)
                {
                    return(true);
                }
            }
            else
            {
                if (Ships.Count(s => s.Type == ShipType.Destroyer) == 2)
                {
                    return(false);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
 public bool IsDatabaseEmpty()
 {
     return
         (SalesUnits.Count() == 0 &&
          Ships.Count() == 0 &&
          Bookings.Count() == 0
         );
 }