public override void Book(BookingContext context, string name)
 {
     throw new InvalidOperationException("Invalid action for state: Booked");
 }
 public override void EnterState(BookingContext context)
 {
     Console.WriteLine($"Booking ID: {context.BookingId} created for {context.Name}");
 }
 public override void Cancel(BookingContext context)
 {
     context.TransitionToState(new ClosedBookingState());
 }
Exemplo n.º 4
0
        public override void Book(BookingContext context, string name)
        {
            context.Name = name;

            context.TransitionToState(new BookedBookingState());
        }
Exemplo n.º 5
0
        public override void EnterState(BookingContext context)
        {
            context.BookingId = Guid.NewGuid();

            Console.WriteLine($"Created new booking ID: {context.BookingId}");
        }
 public override void Cancel(BookingContext context)
 {
     throw new InvalidOperationException("Invalid action for state: Closed");
 }