private static ReferralHotelProfile ToDomain(ReferralHotelProfileEntity entity) => new ReferralHotelProfile { ReferralHotelId = entity.ReferralHotelId, Email = entity.Email, PhoneNumber = entity.PhoneNumber, Name = entity.Name };
public async Task<ReferralHotelProfileErrorCodes> InsertAsync(ReferralHotelProfile referralHotelProfile) { using (var context = _contextFactory.CreateDataContext()) { var entity = await context.ReferralHotelProfiles.FindAsync(referralHotelProfile.ReferralHotelId); if (entity != null) return ReferralHotelProfileErrorCodes.ReferralHotelProfileAlreadyExists; entity = new ReferralHotelProfileEntity(referralHotelProfile); entity = _encryptionService.Encrypt(entity); context.ReferralHotelProfiles.Add(entity); await context.SaveChangesAsync(); } return ReferralHotelProfileErrorCodes.None; }