public void Facade_without_design() { /* client part */ var coldAppID = 1; var hotEntreeID = 2; var drinkID = 3; /************* */ var chief = new Chief("Foo"); //place the order ("Passer la commande") var coldPrep = new ColdPrep(); var bar = new Bar(); var hotPrep = new HotPrep(); Console.WriteLine("{0} places order for cold app #" + coldAppID.ToString() + ", hot entree #" + hotEntreeID.ToString() + ", and drink #" + drinkID.ToString() + ".", chief.Name); Order order = new Order(); order.Appetizer = coldPrep.PrepDish(coldAppID); order.Entree = hotPrep.PrepDish(hotEntreeID); order.Drink = bar.PrepDish(drinkID); }
public Order PlaceOrder(Chief patron, int coldAppID, int hotEntreeID, int drinkID) { Console.WriteLine("{0} places order for cold app #" + coldAppID.ToString() + ", hot entree #" + hotEntreeID.ToString() + ", and drink #" + drinkID.ToString() + ".", patron.Name); Order order = new Order(); order.Appetizer = _coldPrep.PrepDish(coldAppID); order.Entree = _hotPrep.PrepDish(hotEntreeID); order.Drink = _bar.PrepDish(drinkID); return(order); }
public void Facade_with_design() { /* client part */ var coldAppID = 1; var hotEntreeID = 2; var drinkID = 3; /************* */ var chief = new Chief("Foo"); //our new simple interface to place the order var server = new Server(); server.PlaceOrder(chief, coldAppID, hotEntreeID, drinkID); }