public Order(Guid id, Guid conferenceId, IEnumerable <OrderItem> items, IPricingService pricingService) : this(id) { var all = ConvertItems(items); var totals = pricingService.CalculateTotal(conferenceId, all.AsReadOnly()); this.Update(new OrderPlaced { ConferenceId = conferenceId, Seats = all, ReservationAutoExpiration = DateTime.UtcNow.Add(ReservationAutoExpiration), AccessCode = HandleGenerator.Generate(6) }); this.Update(new OrderTotalsCalculated { Total = totals.Total, Lines = totals.Lines != null ? totals.Lines.ToArray() : null, IsFreeOfCharge = totals.Total == 0m }); }
protected Order() { this.Registrant = new Registrant(); this.AccessCode = HandleGenerator.Generate(5); }