Esempio n. 1
0
        private async Task DeleteCustomer(int customerID, CancellationToken cancellationToken)
        {
            var customer = await _dbContext.Customers.FindAsync(customerID, cancellationToken);

            _dbContext.Customers.Remove(customer);

            await _dbContext.SaveChangesAsync(cancellationToken);
        }
Esempio n. 2
0
        public async Task Handle(OrderCreatedV1Notification notification, CancellationToken cancellationToken)
        {
            var customer = await _dbContext.Customers.SingleOrDefaultAsync(i => i.ID == notification.CustomerID && i.HasOrders == false, cancellationToken);

            if (customer == null)
            {
                return;
            }

            customer.HasOrders = true;

            await _dbContext.SaveChangesAsync(cancellationToken);
        }
Esempio n. 3
0
 public Task SaveChanges(CancellationToken cancellationToken) => _dbContext.SaveChangesAsync(cancellationToken);
Esempio n. 4
0
        private async Task UpdateCustomer(Customer customer, CancellationToken cancellationToken)
        {
            _dbContext.Update(customer);

            await _dbContext.SaveChangesAsync(cancellationToken);
        }