Beispiel #1
0
        public async Task Update(string selectedId, string email)
        {
            var users = await _userStore.Query().ToListAsync();

            foreach (var user in users)
            {
                if (user.UserId == selectedId)
                {
                    user.Email = email;
                }
                else
                {
                    user.Email = $"{user.UserId}@example.com";
                }
            }

            await _userStore.UpdateRangeAsync(users);
        }
Beispiel #2
0
        public async Task UpdateAsync(UserUpdatedIntegrationEvent integrationEvent)
        {
            var flatForRentAnnouncementPreferences =
                await _cosmosStore.Query().Where(x => x.UserId == integrationEvent.UserId).ToListAsync();

            foreach (var flatForRentAnnouncementPreference in flatForRentAnnouncementPreferences)
            {
                flatForRentAnnouncementPreference.ServiceActive = integrationEvent.ServiceActive;
                flatForRentAnnouncementPreference.AnnouncementSendingFrequency = integrationEvent.AnnouncementSendingFrequency;
            }

            var updateResult = await _cosmosStore.UpdateRangeAsync(flatForRentAnnouncementPreferences);

            if (!updateResult.IsSuccess)
            {
                throw new UpdateManyFailureException();
            }
        }