Пример #1
0
        public System.Collections.Generic.List <Topping> GetList()
        {
            PizzaboxDBContext Context = new PizzaboxDBContext();
            ToppingMapper     Mapper  = new ToppingMapper();

            return(Context.PizzaToppings.Select(Mapper.Map).ToList());
        }
Пример #2
0
        public List <ToppingDAO> getToppings()
        {
            List <ToppingDAO> toppings = new List <ToppingDAO>();

            foreach (var item in data.GetToppingsList())
            {
                toppings.Add(ToppingMapper.Topping_ToppingDAO(item));
            }
            return(toppings);
        }
Пример #3
0
        public PizzaOrderDAO GetPizzaOrder(int id)
        {
            PizzaOrderDAO   po           = new PizzaOrderDAO();
            PizzaOrder      temppo       = new PizzaOrder();
            List <Order>    temporder    = new List <Order>();
            List <Pizza>    temppizzas   = new List <Pizza>();
            List <PizzaDAO> temppizzaDAO = new List <PizzaDAO>();


            temppo      = data.GetPizzaOrderByID(id);
            po.ID       = temppo.PizzaOrderID;
            po.Customer = GetCustomerByID(int.Parse(temppo.CustomerID.ToString()));
            temporder   = data.GetOrderByID(po.ID);
            temppizzas  = data.GetPizzaList(temporder);

            foreach (var item in temppizzas)
            {
                var tempToppings    = data.GetToppingsOnPizza(int.Parse(item.PizzaID.ToString()));
                var tempCheeses     = data.GetCheesesOnPizza(int.Parse(item.PizzaID.ToString()));
                var tempToppingsDAO = new List <ToppingDAO>();
                var tempCheesesDAO  = new List <CheeseDAO>();

                foreach (var i in tempToppings)
                {
                    tempToppingsDAO.Add(ToppingMapper.Topping_ToppingDAO(i));
                }
                foreach (var y in tempCheeses)
                {
                    tempCheesesDAO.Add(CheeseMapper.Cheese_CheeseDAO(y));
                }


                var t = new PizzaDAO
                {
                    ID       = item.PizzaID,
                    Crust    = CrustMapper.Crust_CrustDAO(data.GetCrustOnPizza(int.Parse(item.CrustID.ToString()))),
                    Sauce    = SauceMapper.Sauce_SauceDAO(data.GetSauceOnPizza(int.Parse(item.SauceID.ToString()))),
                    Size     = SizeMapper.Size_SizeDAO(data.GetSizeOfPizza(int.Parse(item.SizeID.ToString()))),
                    Toppings = tempToppingsDAO,
                    Cheeses  = tempCheesesDAO
                };

                temppizzaDAO.Add(t);
            }
            OrderDAO order = new OrderDAO();

            order.Pizzas = temppizzaDAO;
            po.Order     = order;

            return(po);
        }