Exemple #1
0
        public async Task UpdateOrder(Order order)
        {
            await VerifyOrderExists(order.ID);

            await VerifyOrderHasNotShipped(order.ID);

            _dbContext.Update(order);

            await _dbContext.SaveChangesAsync();
        }
Exemple #2
0
        public async Task UpdateCustomer(Customer customer)
        {
            await VerifyCustomerExists(customer.ID);

            await VerifyCustomerNameIsUnique(customer);

            _dbContext.Update(customer);

            await _dbContext.SaveChangesAsync();
        }
Exemple #3
0
        public async Task UpdateProduct(Product product)
        {
            await VerifyProductExists(product.ID);

            await VerifyProductNameIsUnique(product);

            _dbContext.Update(product);

            await _dbContext.SaveChangesAsync();
        }
Exemple #4
0
        public async Task <Unit> Handle(UpdateCustomerV1Command request, CancellationToken cancellationToken)
        {
            await VerifyCustomerExists(request.Customer.ID);

            await VerifyCustomerNameIsUnique(request.Customer.ID, request.Customer.FirstName, request.Customer.LastName);

            _dbContext.Update(request.Customer);

            await _dbContext.SaveChangesAsync();

            return(Unit.Value);
        }
Exemple #5
0
        public async Task <Unit> Handle(UpdateProductV1Command request, CancellationToken cancellationToken)
        {
            await VerifyProductExists(request.Product.ID);

            await VerifyProductNameIsUnique(request.Product.ID, request.Product.Name);

            _dbContext.Update(request.Product);

            await _dbContext.SaveChangesAsync();

            return(Unit.Value);
        }
Exemple #6
0
        public async Task <Unit> Handle(UpdateOrderV1Command request, CancellationToken cancellationToken)
        {
            await VerifyOrderExists(request.Order.ID);

            await VerifyOrderHasNotShipped(request.Order.ID);

            _dbContext.Update(request.Order);

            await _dbContext.SaveChangesAsync();

            return(Unit.Value);
        }