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(); } }
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(); } }
public void SpecialEvents_Delete(SpecialEvent item) { using (eRestaurantContext context = new eRestaurantContext()) { // Lookup the instance and record if found SpecialEvent existing = context.SpecialEvents.Find(item.EventCode); // Setup the command to execute the delete context.SpecialEvents.Remove(existing); //command is not executed until it is actually saved. context.SaveChanges(); } }
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; } }
public void SpecialEvents_ADD(SpecialEvent item) { using (eRestaurantContext context = new eRestaurantContext()) { /* These methods are executed using an instance level item * set up a instance pointer and initialize to null */ SpecialEvent added = null; // setup the command to execute the add added = context.SpecialEvents.Add(item); // command is not executed until it is actually saved. context.SaveChanges(); } }