コード例 #1
0
        public void UpdateEmployee(BusinessObjects.Employee employee)
        {
            // Get the current employee entity
            var entity = Db.Employees.Find(employee.BusinessEntityId);

            // Map our business object onto the entity
            employee.MapOntoEntity(entity);

            // Save the changes to the entity
            Db.SaveChanges();
        }
コード例 #2
0
        public void AddPhoneNumber(BusinessObjects.PersonPhone phoneNumber)
        {
            // Create new entity to add
            var newNumber = new PersonPhone();

            // Map the BO data onto this new entity
            phoneNumber.MapOntoEntity(newNumber);

            // Add this entity to the context
            Db.PersonPhones.Add(newNumber);

            // Save the changes
            Db.SaveChanges();
        }