Exemplo n.º 1
0
        public async Task <UserProfileResponse> UpdateUserSettingsAsync(UserProfileRequest request)
        {
            Ensure.That(request, nameof(request)).IsNotNull();

            var settings = await FindSettingsAsync(request.UserId);

            settings = Mapper.Map(request, settings);

            var updatedSettings = await _store.UpdateAsync(settings);

            return(Mapper.Map <UserProfileSettings, UserProfileResponse>(updatedSettings));
        }
        public async Task <UserSettings> UpdateAsync(UserSettings settings)
        {
            await sync.WaitAsync();

            try
            {
                var newSettings = await _originalDataStore.UpdateAsync(settings);

                _cache.Remove(GetKey(settings.UserId));
                return(newSettings);
            }
            finally
            {
                sync.Release();
            }
        }