예제 #1
0
        public Pizza GetPizza()
        {
            Pizza pizza = pizzaBuilder.GetPizza();

            PrintPizza(pizza);
            return(pizza);
        }
예제 #2
0
 public Pizza Build(IPizzaBuilder builder)
 {
     builder.SetName()
     .SetDescription()
     .SetPrice()
     .SetToppings();
     return(builder.GetPizza());
 }
예제 #3
0
파일: Program.cs 프로젝트: gabajoba/Lab2
        public static void MakeSomePizza(IPizzaBuilder builder)
        {
            bool   loopBreak = true;
            string str       = null;

            while (str != "0")
            {
                Console.WriteLine("\nChoose your option:\n");
                Console.WriteLine("" +
                                  "1 - Add Cheese\n" +
                                  "2 - Add Tomatoes\n" +
                                  "3 - Add Olives\n" +
                                  "4 - Add Meat\n" +
                                  "5 - Make Pizza\n" +
                                  "\n0 - exit\n");
                str = Console.ReadLine();
                switch (str)
                {
                case "1": builder.AddCheese(); loopBreak = false; break;

                case "2": builder.AddTomatoes(); loopBreak = false; break;

                case "3": builder.AddOlives(); loopBreak = false; break;

                case "4": builder.AddMeat(); loopBreak = false; break;

                case "5": Console.Write(builder.GetPizza()
                                        .ListIngredients()); loopBreak = true; break;

                case "0": loopBreak = true; break;

                default: Console.WriteLine("Enter the required number\n"); break;
                }
                if (loopBreak != false)
                {
                    builder.Reset();
                    break;
                }
            }
        }
예제 #4
0
 public Pizza GetPizza()
 {
     return(_pizzaBuilder.GetPizza());
 }