Esempio n. 1
0
        public void Location_Update(Location item)
        {
            using (WorkScheduleContext context = new WorkScheduleContext())
            {
                context.Entry <Location>(context.Locations.Attach(item)).State = System.Data.Entity.EntityState.Modified;

                context.SaveChanges();
            }
        }
Esempio n. 2
0
        public void UpdateLocation(Location item)
        {
            using (var context = new WorkScheduleContext())
            {
                // Edit current location
                var attached = context.Locations.Attach(item);

                var existing = context.Entry <Location>(attached);

                existing.State = System.Data.Entity.EntityState.Modified;

                context.SaveChanges();
            }
        }
Esempio n. 3
0
        public void EmployeeSkill_Update(EmployeeSkillItem item)
        {
            using (var context = new WorkScheduleContext())
            {
                EmployeeSkill updateItem = new EmployeeSkill
                {
                    //for an update, you need to supply your PK value
                    EmployeeSkillID   = item.EmployeeSkillID,
                    EmployeeID        = item.EmployeeID,
                    SkillID           = item.SkillID,
                    Level             = item.Level,
                    YearsOfExperience = item.YearsOfService,
                    HourlyWage        = item.HourlyWage
                };
                context.Entry(updateItem).State = System.Data.Entity.EntityState.Modified;

                context.SaveChanges();
            }
        }