예제 #1
0
        public static void AddOrder(Domain.OrdersManager newOrder)
        {
            PizzaEntities db    = new PizzaEntities();
            var           order = ConvertOrderToEntity(newOrder);

            db.Orders.Add(order);
            db.SaveChanges();
        }
예제 #2
0
        public static Order ConvertOrderToEntity(Domain.OrdersManager newOrder)
        {
            var order = new Order();

            order.Id            = newOrder.Id;
            order.Size          = newOrder.Pizza.Size;
            order.Crust         = newOrder.Pizza.Crust;
            order.Sausage       = newOrder.Pizza.Sausage;
            order.Pepperoni     = newOrder.Pizza.Pepperoni;
            order.Onions        = newOrder.Pizza.Onions;
            order.GreenPeppers  = newOrder.Pizza.GreenPeppers;
            order.Total         = newOrder.Pizza.Total;
            order.Name          = newOrder.Delivery.Name;
            order.Address       = newOrder.Delivery.Address;
            order.Zip           = newOrder.Delivery.Zip;
            order.Phone         = newOrder.Delivery.Phone;
            order.PaymentMethod = newOrder.Delivery.PaymentMethod;
            order.Complete      = newOrder.Complete;

            return(order);
        }
예제 #3
0
        // create a new delivery
        public Domain.OrdersManager PlaceOrder()
        {
            var newOrder = new Domain.OrdersManager();

            newOrder.Id               = Guid.NewGuid();
            newOrder.Pizza            = UpdateTotal();
            newOrder.Delivery         = new Domain.Delivery();
            newOrder.Delivery.Name    = nameTextBox.Text;
            newOrder.Delivery.Address = addressTextBox.Text;
            newOrder.Delivery.Zip     = zipTextBox.Text;
            newOrder.Delivery.Phone   = phoneTextBox.Text;
            if (cashRadioButton.Checked)
            {
                newOrder.Delivery.PaymentMethod = Domain.PaymentMethod.Cash;
            }
            else if (creditRadioButton.Checked)
            {
                newOrder.Delivery.PaymentMethod = Domain.PaymentMethod.Credit;
            }
            newOrder.Complete = false;
            return(newOrder);
        }
예제 #4
0
 public static void SaveOrder(Domain.OrdersManager Order)
 {
     DAL.OrdersRepository.AddOrder(Order);
 }