Пример #1
0
            public Order(Guid id, Guid userId, string number, decimal price)
            {
                var @event = new OrderCreated(id, userId, number, price);

                Enqueue(@event);
                Apply(@event);
            }
 void Apply(OrderCreated @event)
 {
     databaseConnection.Execute(
         @"UPDATE UserDashboards
         SET OrdersCount = OrdersCount + 1,
             TotalAmount = TotalAmount + @Amount
         WHERE Id = @UserId",
         @event
         );
 }
Пример #3
0
 private void Apply(OrderCreated @event)
 {
     throw new NotImplementedException("TODO");
 }
Пример #4
0
 private void Apply(OrderCreated @event)
 {
     Id     = @event.OrderId;
     Number = @event.Number;
     Amount = @event.Amount;
 }
Пример #5
0
 private void Apply(UserDashboard item, OrderCreated @event)
 {
     item.TotalAmount += @event.Amount;
     item.OrdersCount++;
 }