コード例 #1
0
 public void Confirm()
 {
     if (!_status.CanAdvance)
     {
         return;                      // or throw an exception
     }
     _status           = ReservationStatus.Confirmed();
     _reservedQuantity = _requestedQuantity;
 }
コード例 #2
0
        internal Reservation(ReservationMemento memento)
        {
            _id                = memento.Id;
            _ticketId          = memento.TicketId;
            _requestedQuantity = memento.RequestedQuantity;
            _reservedQuantity  = memento.ReservedQuantity;

            var statusType = (ReservationStatus.StatusType)Enum.Parse(typeof(ReservationStatus.StatusType), memento.Status);

            _status = new ReservationStatus(statusType, memento.LastUpdated);
        }
コード例 #3
0
 private Reservation(int ticketId, int requestedQuantity)
 {
     _ticketId          = ticketId;
     _requestedQuantity = requestedQuantity;
     _status            = ReservationStatus.Open();
 }