Ejemplo n.º 1
0
        //Method #4
        //Creates an entry in the order table, which generates an order number
        public static bool createNewOrderNumber(Order newOrder)
        {
            using (var context = new CustomersEntities())
            {
                context.ContextOptions.LazyLoadingEnabled = false;
                context.Orders.AddObject(newOrder);

                bool sucess = context.SaveChanges() == 1;
                if (sucess)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 2
0
        //Method #5
        //Creates an entry in the Items table.
        public static bool addItemToOrder(Order_item newItem)
        {
            using (var context = new CustomersEntities())
            {
                context.ContextOptions.LazyLoadingEnabled = false;
                context.Order_item.AddObject(newItem);

                bool sucess = context.SaveChanges() == 1;
                if (sucess)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 3
0
        //Method #6
        //Creates an entry in the Items table.
        public static bool removeItemFromOrder(Order_item deleteItem)
        {
            using (var context = new CustomersEntities())
            {
                context.ContextOptions.LazyLoadingEnabled = false;
                context.Attach(deleteItem);
                context.Order_item.DeleteObject(deleteItem);

                bool sucess = context.SaveChanges() == 1;
                if (sucess)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }