public UnitOfWork(PizzaBoxDbContext context)
 {
     _context  = context;
     MenuItems = new MenuFactory(_context);
     Pizzas    = new PizzaFactory(_context);
     Sizes     = new SizeFactory(_context);
     Crusts    = new CrustFactory(_context);
     Toppings  = new ToppingFactory(_context);
     Orders    = new OrderFactory(_context);
 }
Exemplo n.º 2
0
        public void Run()
        {
            try
            {
                string[] pizzaElements = Console.ReadLine()
                                         .Split(" ")
                                         .ToArray();

                string[] doughElements = Console.ReadLine()
                                         .Split(" ")
                                         .ToArray();

                Dough dough = DoughFactory.Create(doughElements);

                Pizza pizza = PizzaFactory.Create(pizzaElements, dough);

                string input = string.Empty;

                while ((input = Console.ReadLine()) != "END")
                {
                    string[] toppingElements = input
                                               .Split(" ")
                                               .ToArray();

                    Topping topping = ToppingFactory.Create(toppingElements);

                    pizza.AddTopping(topping);
                }

                Console.WriteLine(pizza);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }