Exemplo n.º 1
0
 public LeaseOrder(LeaseOrderId leaseId, BuyerId buyerId, DateCreated dateCreated, IsDelivery isDelivery, IsPaid isPaid, Street street, ZipCode zipCode, City city)
 {
     LeaseOrderLines = new List <LeaseOrderLine>();
     Apply(new LeaseOrderEvents.CreateLeaseOrder
     {
         LeaseId     = leaseId,
         DateCreated = dateCreated,
         IsDelivery  = isDelivery,
         IsPaid      = isPaid,
         Street      = street,
         ZipCode     = zipCode,
         City        = city,
         CustomerId  = buyerId,
     });
 }
Exemplo n.º 2
0
        protected override void When(object @event)
        {
            switch (@event)
            {
            case LeaseOrderEvents.CreateLeaseOrder e:
                Id = new LeaseOrderId(e.LeaseId);

                DateCreated = new DateCreated(e.DateCreated);
                IsDeleted   = new IsDeleted(e.IsDeleted);
                IsDelivery  = new IsDelivery(e.IsDelivery);
                IsPaid      = new IsPaid(e.IsPaid);
                BuyerId     = new BuyerId(e.CustomerId);
                TotalPrice  = new TotalPrice(e.TotalPrice);
                Street      = new Street(e.Street);
                ZipCode     = new ZipCode(e.ZipCode);
                City        = new City(e.City);
                break;

            case LeaseOrderEvents.LeaseAddressUpdated e:
                Street  = new Street(e.Street);
                ZipCode = new ZipCode(e.ZipCode);
                City    = new City(e.City);
                break;

            case LeaseOrderEvents.DateCreatedUpdated e:
                DateCreated = new DateCreated(e.DateCreated);
                break;

            case LeaseOrderEvents.LeaseDeleted e:
                IsDeleted = new IsDeleted(e.IsDeleted);
                break;

            case LeaseOrderEvents.IsDeliveryUpdated e:
                IsDelivery = new IsDelivery(e.IsDelivery);
                break;

            case LeaseOrderEvents.IsPaidUpdated e:
                IsPaid = new IsPaid(e.IsPaid);
                break;

            case LeaseOrderEvents.TotalPriceUpdated e:
                TotalPrice = new TotalPrice(e.TotalPrice);
                break;
            }
        }