Exemple #1
0
        public bool Remove(Residence residence, Rentals rentals)
        {
            // check if still used in rentals: can't remove then!
            foreach (Rental rental in rentals.AllRentals)
            {
                if (rental.HolidayResidence == residence)
                {
                    return(false);
                }
            }

            return(AllResidences.Remove(residence));
        }
Exemple #2
0
        public bool DeleteResidence(Residence residence)
        {
            Rentals rentals = new Rentals();

            foreach (Rental rental in rentals.AllRentals)
            {
                if (rental.HolidayResidence == residence)
                {
                    return(false);
                }
            }
            allResidences.Remove(residence);
            residence = null;
            return(true);
        }