示例#1
0
        static void Main(string[] args)
        {
            ManagerMediator managerMediator = new ManagerMediator();

            LandlordPerson landlord = new LandlordPerson(managerMediator, new Apartament {
                Address = "Московская 3", Price = 12000
            });

            landlord.Apartament.Owner = landlord;
            RenterPerson renter = new RenterPerson(managerMediator);

            managerMediator.LandlordPerson = landlord;
            managerMediator.RenterPerson   = renter;

            landlord.Send("Сдаю в аренду квартиру " + "| Address: " + landlord.Apartament.Address);
            renter.Send("Готов арендовать квартиру!");
            landlord.ToRent(renter);

            Console.ReadLine();
        }
示例#2
0
 public void ToRent(RenterPerson renter)
 {
     mediator.ToRent(this, renter);
 }
示例#3
0
 public abstract void ToRent(LandlordPerson landlord, RenterPerson renter);
 public override void ToRent(LandlordPerson landlord, RenterPerson renter)
 {
     landlord.Apartament.Renter = renter;
     renter.Apartament          = landlord.Apartament;
     Console.WriteLine("Сделка успешно удалась!");
 }