private static ReferralFriendProfile ToDomain(ReferralFriendProfileEntity entity) => new ReferralFriendProfile { ReferralFriendId = entity.ReferralFriendId, ReferrerId = entity.ReferrerId, FullName = entity.FullName, Email = entity.Email };
public async Task <ReferralFriendProfileErrorCodes> InsertAsync(ReferralFriendProfile referralFriendProfile) { using (var context = _contextFactory.CreateDataContext()) { var entity = await context.ReferralFriendProfiles.FindAsync(referralFriendProfile.ReferralFriendId); if (entity != null) { return(ReferralFriendProfileErrorCodes.ReferralFriendProfileAlreadyExists); } entity = new ReferralFriendProfileEntity(referralFriendProfile); entity = _encryptionService.Encrypt(entity); context.ReferralFriendProfiles.Add(entity); await context.SaveChangesAsync(); } return(ReferralFriendProfileErrorCodes.None); }