Пример #1
0
 public override void Send(string msg, Person person)
 {
     if (LandlordPerson == person)
     {
         RenterPerson.Notify(msg);
     }
     else if (RenterPerson == person)
     {
         LandlordPerson.Notify(msg);
     }
 }
Пример #2
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();
        }
Пример #3
0
 public abstract void ToRent(LandlordPerson landlord, RenterPerson renter);
Пример #4
0
 public override void ToRent(LandlordPerson landlord, RenterPerson renter)
 {
     landlord.Apartament.Renter = renter;
     renter.Apartament          = landlord.Apartament;
     Console.WriteLine("Сделка успешно удалась!");
 }