public async Task HandleAsync(AddUpdateProductCommand command, CancellationToken cancellationToken = default)
        {
            using (await _unitOfWork.BeginTransactionAsync(System.Data.IsolationLevel.ReadCommitted, cancellationToken))
            {
                await _productService.AddOrUpdateAsync(command.Product);

                await _unitOfWork.CommitTransactionAsync(cancellationToken);
            }
        }
        public async Task HandleAsync(EntityDeletedEvent <FileEntry> domainEvent, CancellationToken cancellationToken = default)
        {
            await _auditSerivce.AddOrUpdateAsync(new AuditLogEntry
            {
                UserId          = _currentUser.IsAuthenticated ? _currentUser.UserId : Guid.Empty,
                CreatedDateTime = domainEvent.EventDateTime,
                Action          = "DELETE_FILEENTRY",
                ObjectId        = domainEvent.Entity.Id.ToString(),
                Log             = domainEvent.Entity.AsJsonString(),
            });

            await _eventLogRepository.AddOrUpdateAsync(new EventLog
            {
                EventType       = "FILEENTRY_DELETED",
                TriggeredById   = _currentUser.UserId,
                CreatedDateTime = domainEvent.EventDateTime,
                ObjectId        = domainEvent.Entity.Id.ToString(),
                Message         = domainEvent.Entity.AsJsonString(),
                Published       = false,
            }, cancellationToken);

            await _eventLogRepository.UnitOfWork.SaveChangesAsync(cancellationToken);
        }
Пример #3
0
        public async Task HandleAsync(EntityUpdatedEvent <Product> domainEvent, CancellationToken cancellationToken = default)
        {
            await _auditSerivce.AddOrUpdateAsync(new AuditLogEntry
            {
                UserId          = _currentUser.UserId,
                CreatedDateTime = domainEvent.EventDateTime,
                Action          = "UPDATED_PRODUCT",
                ObjectId        = domainEvent.Entity.Id.ToString(),
                Log             = domainEvent.Entity.AsJsonString(),
            });

            await _eventLogRepository.AddOrUpdateAsync(new EventLog
            {
                EventType       = "PRODUCT_UPDATED",
                TriggeredById   = _currentUser.UserId,
                CreatedDateTime = domainEvent.EventDateTime,
                ObjectId        = domainEvent.Entity.Id.ToString(),
                Message         = domainEvent.Entity.AsJsonString(),
                Published       = false,
            }, cancellationToken);

            await _eventLogRepository.UnitOfWork.SaveChangesAsync(cancellationToken);
        }
Пример #4
0
 public async Task HandleAsync(AddUpdateProductCommand command)
 {
     await _productService.AddOrUpdateAsync(command.Product);
 }
Пример #5
0
 public async Task HandleAsync(AddUpdateProductCommand command, CancellationToken cancellationToken = default)
 {
     await _productService.AddOrUpdateAsync(command.Product);
 }
Пример #6
0
 public async Task HandleAsync(AddOrUpdateEntityCommand <TEntity> command, CancellationToken cancellationToken = default)
 {
     await _crudService.AddOrUpdateAsync(command.Entity);
 }
 public async Task HandleAsync(AddOrUpdateEntityCommand <TEntity> command)
 {
     await _crudService.AddOrUpdateAsync(command.Entity);
 }