public void Waiters_Update(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { // indicate the updateing 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 it actually saved. context.SaveChanges(); } }
public int Waiters_Add(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { // these methods are execute using an instance level item // set up a instance pointer and initialize to null Waiter added = null; // set up commanc to execute the add added = context.Waiters.Add(item); //command is not executed until it it actually saved. context.SaveChanges(); // the Waiter instance added contains the newly inserted // record to sql including the generated play value return added.WaiterID; } }
public void Waiters_Delete(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { // indicate the updateing item instance //alter the Modified Status flag for this instance Waiter existing = context.Waiters.Find(item.WaiterID); // set up the command to execute the delete context.Waiters.Remove(existing); //command is not executed until it it actually saved. context.SaveChanges(); } }
public int Waiters_Add(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { //these methods are execute 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(); //added contains the data of the newly added waiter //including the pkey value. return added.WaiterID; } }
public void Waiters_Delete(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { //lookup the instance and record if found (set pointer to instance) 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 Waiters_Delete(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { //look the item instance on the database to determine if it exists //on the delete ensure you reference the P-Key Waiter existing = context.Waiters.Find(item); //set up the data request command context.Waiters.Remove(existing); //commit the action to happen context.SaveChanges(); } }
public void Waiters_Update(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { context.Entry<Waiter>(context.Waiters.Attach(item)).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public int Waiter_Add(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { //these methods are executed using an instant level item. //setup 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 saved context.SaveChanges(); //the waiter instance added cointains the newly created record to SQL including the generated Primary key value\ return added.WaiterID; } }
public int Waiters_Add(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { //create a pointer variable for the instance type //set this pointer to null Waiter added = null; //set up the add request for the dbcontext added = context.Waiters.Add(item); //saving the changes will cause the .Add to execute //commits the add to the database //evaluates the annotations (validation) on your entity context.SaveChanges(); //added contains the data of the newly added waiter //including rgw pkey value. return added.WaiterID; } }
public int Waiters_Add(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { Waiter added = null; added = context.Waiters.Add(item); //comment is not used until it is actully save context.SaveChanges(); //the waiter instence added contains the newly inserted //record to sql including the genrated pkey value return added.WaiterID; } }
public void Waiter_Delete(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { Waiter existing = context.Waiters.Find(item.WaiterID); context.Waiters.Remove(existing); context.SaveChanges(); } }
public void Waiters_Delete(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { //lookup the item instance to determine if the instance exists Waiter existing = context.Waiters.Find(item.WaiterID); //setup the delete request command context.Waiters.Remove(existing); //commit the action to happen. context.SaveChanges(); } }
public void Waiter_Delete(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { //lookup the item instance on the database to determine if the instance exists //ensure you reference the PK field name (item.EVENTCODE) Waiter existing = context.Waiters.Find(item.WaiterID); //set up the delete request command context.Waiters.Remove(existing); //commit the action to happen context.SaveChanges(); } }
public int Waiter_Add(Waiter item) { //input into this method is at the instance level using (eRestaurantContext context = new eRestaurantContext()) { //create a pointer variable for the instance type. //Set this pointer to null. Waiter added = null; //Set up the add request for the dbcontext added = context.Waiters.Add(item); //Saving the changes will cause the .Add to execute (delayed execution) //Commits the add to the database //Evaluates the annotations (validation) on your entity context.SaveChanges(); //added contains the data of the newly added waiter including the PK value return added.WaiterID; } }
public void Waiters_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 add context.Waiters.Remove(existing); //command not executed until saved context.SaveChanges(); } }
public void Waiter_Delete(Waiter item) { using (eRestaurantContext context = new eRestaurantContext()) { //lookup the instance and record if found SpecialEvent existing = context.SpecialEvents.Find(item.WaiterID); //if the record is found then remove the instance context.SpecialEvents.Remove(existing); // the command is not executed until it is actually saved context.SaveChanges(); } }