Esempio n. 1
0
        public async Task <Core.Domain.ResetPasswordAccessToken> UpdateAsync(Core.Domain.ResetPasswordAccessToken src)
        {
            AzureIndex index = await _indexByPublicIdStorage.GetDataAsync(
                ResetPasswordAccessTokenEntity.IndexByPublicId.GeneratePartitionKey(src.PublicId),
                ResetPasswordAccessTokenEntity.IndexByPublicId.GenerateRowKey());

            if (index == null)
            {
                throw new KeyNotFoundException();
            }

            ResetPasswordAccessTokenEntity updatedEntity = await _storage.MergeAsync(
                ResetPasswordAccessTokenEntity.ByEmployeeId.GeneratePartitionKey(index.PrimaryPartitionKey),
                ResetPasswordAccessTokenEntity.ByEmployeeId.GenerateRowKey(index.PrimaryRowKey),
                entity =>
            {
                entity.Redeemed = src.Redeemed;

                return(entity);
            });

            if (updatedEntity == null)
            {
                throw new KeyNotFoundException();
            }

            return(Mapper.Map <Core.Domain.ResetPasswordAccessToken>(updatedEntity));
        }
Esempio n. 2
0
        public async Task <Core.Domain.ResetPasswordAccessToken> CreateAsync(Core.Domain.ResetPasswordAccessToken token)
        {
            ResetPasswordAccessTokenEntity entity = ResetPasswordAccessTokenEntity.ByEmployeeId.Create(token);

            await _storage.InsertThrowConflict(entity);

            AzureIndex index = ResetPasswordAccessTokenEntity.IndexByPublicId.Create(entity);

            await _indexByPublicIdStorage.InsertThrowConflict(index);

            return(Mapper.Map <Core.Domain.ResetPasswordAccessToken>(entity));
        }