public void Handle(WarehouseItemQuantitySubstracted message)
        {
            if (!IsItemExist(message.WarehouseId, message.ProductId))
            {
                return;
            }

            WarehouseItemReadView warehouseItem = GetItem(message.WarehouseId, message.ProductId);

            warehouseItem.Quantity -= message.Quantity;

            db.SaveChanges();
        }
Exemple #2
0
        public void Handle(OrderCreated message)
        {
            if (IsOrderExist(message.OrderId))
            {
                return;
            }

            var orderView = new OrderReadView
            {
                Id         = message.OrderId,
                Status     = message.Status,
                CustomerId = message.CustomerId
            };

            db.OrderViews.Add(orderView);
            db.SaveChanges();
        }