public void Handle(OrderItemRemoved evnt)
 {
     _connection.Delete(
         new { OrderId = evnt.OrderId, ProductId = evnt.ProductId },
         "eventsourcing_sample_orderitem",
         _transaction);
 }
        public void Apply(OrderItemRemoved e)
        {
            var item = Items.FirstOrDefault(i => i.PersonName == e.PersonName);

            if (item != null)
            {
                Items.Remove(item);
            }
        }
示例#3
0
        protected void MutateWhen(OrderItemRemoved @event)
        {
            // build new list
            var items = new List <OrderItem>();

            items.AddRange(Items.Where(x => x.Name != @event.Name));
            // set to list without item
            Items = items;
        }
示例#4
0
        private NpgsqlCommand ToCommand(OrderItemRemoved data)
        {
            var command = new NpgsqlCommand("DELETE FROM reads.order_item WHERE order_id = @Id and person_name = @PersonName");

            command.Parameters.Add(new NpgsqlParameter("@PersonName", data.PersonName));
            command.Parameters.Add(new NpgsqlParameter("@Id", data.OrderId));

            return(command);
        }
        private void WhenItemRemoved(OrderItemRemoved e, OrderView view)
        {
            // build new list
            var items = new List <OrderItem>();

            items.AddRange(view.Items.Where(x => x.Name != e.Name));

            // set to list without item
            view.Items = items;
        }
 protected virtual void OnOrderItemRemoved(object sender, ModifyElementEventArgs <T> e)
 {
     OrderItemRemoved?.Invoke(this, e);
 }
示例#7
0
 protected virtual void OnOrderItemRemoved(ItemCollectionEventArgs eventArgs)
 {
     OrderItemRemoved.Invoke(this, eventArgs);
 }
 protected virtual void Handle(OrderItemRemoved evnt)
 {
     _entityManager.DeleteByQuery<OrderItemEntity>(new { OrderId = evnt.OrderId, ProductId = evnt.ProductId });
 }
 protected virtual void Handle(OrderItemRemoved evnt)
 {
     _entityManager.DeleteByQuery <OrderItemEntity>(new { OrderId = evnt.OrderId, ProductId = evnt.ProductId });
 }