Ejemplo n.º 1
0
        public void Waiter_Delete(Waiter item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
                // Lookup the instance and record if found
                Waiter existing = context.Waiters.Find(item.WaiterID);

                // Setup the command to execute the delete
                context.Waiters.Remove(existing);

                //command is not executed until it is actually saved.
                context.SaveChanges();

            }
        }
Ejemplo n.º 2
0
        public void Waiter_Update(Waiter item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
                // Indicate the updating item instance
                // alter the Modified Status flag for this instance
                context.Entry<Waiter>(context.Waiters.Attach(item)).State = System.Data.Entity.EntityState.Modified;

                // command is not executed until it is actually saved.
                context.SaveChanges();

            }
        }
Ejemplo n.º 3
0
        public int Waiters_Add(Waiter item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
                /* These methods are executed using an instance level item
                 * set up a instance pointer and initialize to null */
                Waiter added = null;
                // setup the command to execute the add
                added = context.Waiters.Add(item);
                // command is not executed until it is actually saved.
                context.SaveChanges();

                // The waiter instance added contains the newly inserted
                // record to sql including the generated primary key value
                return added.WaiterID;

            }
        }