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 command to execute the delete
                context.SpecialEvents.Remove(existing);
                //command is not executed untill it is actually saved
                context.SaveChanges();
            }
        }
        public void SpecialEvents_Update(SpecialEvent item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
                //Indicate the updating item instance
                //alter the modified status flag for this instance

                context.Entry<SpecialEvent>(context.SpecialEvents.Attach(item)).State = System.Data.Entity.EntityState.Modified;
                //command is not executed untill it is actually saved
                context.SaveChanges();
            }
        }
Пример #3
0
        public void SpecialEvent_Delete(SpecialEvent item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {

                // indicate the updateing item instance
                //alter the Modified Status flag for this instance
                SpecialEvent existing = context.SpecialEvents.Find(item.EventCode);
                // set up the command to execute the delete
                context.SpecialEvents.Remove(existing);
                //command is not executed until it it actually saved.
                context.SaveChanges();
            }
        }
        public void SpecialEvents_Add(SpecialEvent item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
             //these methods are execute using an instance level item

            //Set up a instance pointer and intialize to null
            SpecialEvent added = null;
            //setup the command to execute the add
            added = context.SpecialEvents.Add(item);
             //command is not executed untill it is actually saved
            context.SaveChanges();
            }
        }
Пример #5
0
 public void SpecialEvents_Delete(SpecialEvent 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
         SpecialEvent existing = context.SpecialEvents.Find(item.EventCode);
         //set up the data request command
         context.SpecialEvents.Remove(existing);
         //commit the action to happen
         context.SaveChanges();
     }
 }
Пример #6
0
        public void SpecialEvents_Update(SpecialEvent item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
            context.Entry<SpecialEvent>(context.SpecialEvents.Attach(item)).State = System.Data.Entity.EntityState.Modified;

            context.SaveChanges();

            }
        }
Пример #7
0
        public void SpecialEvents_Add(SpecialEvent item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
                //create a pointer variable for the instance type
                //set this pointer to null
                SpecialEvent added = null;

                //set up the add request for the dbcontext
                added = context.SpecialEvents.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();

            }
        }
Пример #8
0
        public void SpecialEvent_Delete(SpecialEvent item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
                SpecialEvent existing = context.SpecialEvents.Find(item.EventCode);
                context.SpecialEvents.Remove(existing);

                context.SaveChanges();
            }
        }
Пример #9
0
 public void SpecialEvent_Add(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         SpecialEvent added = null;
         added = context.SpecialEvents.Add(item);
         //comment is not used until it is actully save
         context.SaveChanges();
     }
 }
Пример #10
0
        public void SpecialEvent_Delete(SpecialEvent item)
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {
                //lookup the item instance to determine if the instance exists
                SpecialEvent existing = context.SpecialEvents.Find(item.EventCode);
                //setup the delete request command
                context.SpecialEvents.Remove(existing);
                //commit the action to happen.
                context.SaveChanges();

            }
        }
Пример #11
0
        public void SpecialEvents_Add(SpecialEvent 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.
                SpecialEvent added = null;

                //Set up the add request for the dbcontext
                added = context.SpecialEvents.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();
            }
        }