protected override void When(object @event) { switch (@event) { case LeaseOrderLineEvents.LeaseOrderLineAddedToLeaseOrder e: LeaseId = new LeaseOrderId(e.LeaseOrderId); ResourceId = new ResourceId(e.ResourceId); Id = new LeaseOrderLineId(e.LeaseOrderLineId); StartDate = new StartDate(e.StartDate); EndDate = new EndDate(e.EndDate); IsReturned = new IsReturned(e.IsReturned); ResourceName = new ResourceName(e.ResourceName); ResourcePrice = new ResourcePrice(e.ResourcePrice); Quantity = new Quantity(e.Quantity); break; case LeaseOrderLineEvents.LeaseOrderLineUpdated e: StartDate = new StartDate(e.StartDate); EndDate = new EndDate(e.EndDate); IsReturned = new IsReturned(e.IsReturned); ResourceName = new ResourceName(e.ResourceName); ResourcePrice = new ResourcePrice(e.ResourcePrice); Quantity = new Quantity(e.Quantity); break; case LeaseOrderLineEvents.LeaseOrderLineDeleted e: Id = new LeaseOrderLineId(e.LeaseOrderLineId); break; } }
public LeaseOrderLine(LeaseOrderLineId leaseOrderLineId, LeaseOrderId leaseOrderId, ResourceId ResourceId, StartDate startDate, EndDate endDate, IsReturned isReturned, ResourceName ResourceName, ResourcePrice ResourcePrice, Quantity quantity) { Apply(new LeaseOrderLineEvents.LeaseOrderLineAddedToLeaseOrder { LeaseOrderLineId = leaseOrderLineId, LeaseOrderId = leaseOrderId, ResourceId = ResourceId, StartDate = startDate, EndDate = endDate, IsReturned = isReturned, ResourceName = ResourceName, ResourcePrice = ResourcePrice, Quantity = quantity }); }