示例#1
0
 internal void Update(ReferralFriendProfile referralFriendProfile)
 {
     ReferralFriendId = referralFriendProfile.ReferralFriendId;
     ReferrerId       = referralFriendProfile.ReferrerId;
     FullName         = referralFriendProfile.FullName;
     Email            = referralFriendProfile.Email.ToLower();
 }
示例#2
0
        public async Task <ReferralFriendProfileErrorCodes> UpdateAsync(ReferralFriendProfile referralFriendProfile)
        {
            var result = await _referralFriendProfileRepository.UpdateAsync(referralFriendProfile);

            if (result == ReferralFriendProfileErrorCodes.None)
            {
                _log.Info("Referral friend profile updated",
                          context: $"referralFriendId: {referralFriendProfile.ReferralFriendId}");
            }
            else
            {
                _log.Info("An error occurred while updating referral friend profile",
                          context: $"referralHotelId: {referralFriendProfile.ReferralFriendId}; error: {result}");
            }

            return(result);
        }
        public async Task <ReferralFriendProfileErrorCodes> UpdateAsync(ReferralFriendProfile referralFriendProfile)
        {
            using (var context = _contextFactory.CreateDataContext())
            {
                var entity = await context.ReferralFriendProfiles.FindAsync(referralFriendProfile.ReferralFriendId);

                if (entity == null)
                {
                    return(ReferralFriendProfileErrorCodes.ReferralFriendProfileDoesNotExist);
                }

                _encryptionService.Decrypt(entity);

                entity.Update(referralFriendProfile);

                _encryptionService.Encrypt(entity);

                await context.SaveChangesAsync();
            }

            return(ReferralFriendProfileErrorCodes.None);
        }
        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);
        }
示例#5
0
 public ReferralFriendProfileEntity(ReferralFriendProfile referralFriendProfile)
 {
     Update(referralFriendProfile);
 }