Esempio n. 1
0
        private async Task SaveChanges(IFileStorageRepository fileStorageRepository, FileStorage fileStorage, IEnumerable <FileStorage> parentFileStorages)
        {
            using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                try
                {
                    await fileStorageRepository.Update(fileStorage);

                    await fileStorageRepository.Update(parentFileStorages);
                }
                catch (Exception ex)
                {
                    scope.Dispose();
                    throw new Exception(ex.Message, ex);
                }

                scope.Complete();
            }
        }
 /// <summary>
 /// Updates the specified entity.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <returns>Task.</returns>
 public virtual async Task Update(FileStorageEntity entity)
 {
     await _repository.Update(entity);
 }