internal void Update(ReferralHotelProfile referralHotelProfile) { ReferralHotelId = referralHotelProfile.ReferralHotelId; Email = referralHotelProfile.Email; PhoneNumber = referralHotelProfile.PhoneNumber; Name = referralHotelProfile.Name; }
public async Task <ReferralHotelProfileErrorCodes> UpdateAsync(ReferralHotelProfile referralHotelProfile) { var result = await _referralHotelProfileRepository.UpdateAsync(referralHotelProfile); if (result == ReferralHotelProfileErrorCodes.None) { _log.Info("Referral hotel profile updated", context: $"referralHotelId: {referralHotelProfile.ReferralHotelId}"); } else { _log.Info("An error occurred while updating referral hotel profile", context: $"referralHotelId: {referralHotelProfile.ReferralHotelId}; error: {result}"); } return(result); }
public async Task<ReferralHotelProfileErrorCodes> UpdateAsync(ReferralHotelProfile referralHotelProfile) { using (var context = _contextFactory.CreateDataContext()) { var entity = await context.ReferralHotelProfiles.FindAsync(referralHotelProfile.ReferralHotelId); if (entity == null) return ReferralHotelProfileErrorCodes.ReferralHotelProfileDoesNotExist; _encryptionService.Decrypt(entity); entity.Update(referralHotelProfile); _encryptionService.Encrypt(entity); await context.SaveChangesAsync(); } return ReferralHotelProfileErrorCodes.None; }
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; }
public ReferralHotelProfileEntity(ReferralHotelProfile referralHotelProfile) { Update(referralHotelProfile); }