public static EmployerProfileEntity Map(this EmployerProfile profile, Guid employerId) { var entity = new EmployerProfileEntity { employerId = employerId }; profile.MapTo(entity); return(entity); }
void IProfilesRepository.UpdateEmployerProfile(Guid employerId, EmployerProfile profile) { using (var dc = CreateContext()) { // Create or update as needed. var entity = GetEmployerProfileEntity(dc, employerId); if (entity == null) { dc.EmployerProfileEntities.InsertOnSubmit(profile.Map(employerId)); } else { profile.MapTo(entity); } dc.SubmitChanges(); } }