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(); }
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(); }