Пример #1
0
        public async Task <ApiKey> UpdateLastUsedAsync(ApiKey key)
        {
            key.LastUsed = DateTime.Now.ToUniversalTime();

            // Send the key to the database and the store
            try {
                await Task.WhenAll(
                    cache.SetAsync(key.Id.ToString(), key),
                    repository.UpdateAsync(key)
                    );
            } catch (Exception) {
                await cache.RemoveAsync(key.Id.ToString());

                throw;
            }

            return(key);
        }
Пример #2
0
        public async Task <ApiKey?> UpdateAsync(ApiKey apiKey)
        {
            var apiKeyRow = await _apiKeyRepository.UpdateAsync(_mapper.Map <ApiKeyRow>(apiKey));

            return(apiKeyRow?.Let(it => _mapper.Map <ApiKey>(it)));
        }