public void CreateUser(UserProfile userProfile) { using (var context = DbContextFactory.Create()) { var registration = Mapper.Map<UserProfile, Registration>(userProfile); context.Registrations.Add(registration); context.SaveChanges(); } }
public void UpdateUser(UserProfile userProfile) { using (var context = DbContextFactory.Create()) { // Fetch the existing registration record var registration = context.Registrations.Single(r => r.EmailAddress.Equals(userProfile.Email, StringComparison.OrdinalIgnoreCase)); // Map the new details Mapper.Map(userProfile, registration); // Save to database context.SaveChanges(); } }
public void CreateUser(UserProfile userProfile) { _profileRepository.CreateUser(userProfile); }