Exemple #1
0
 public static function buyTicket($date, $time, $visa)
 {
     // call payment service
     // confirm ticket availability and call make payment
     if (TicketService::checkAvailability($date, $time) && PaymentService::makePayment($visa)) {
         return true;
     } else {
         return false;
     }
 }
 public static function buyTicket()
 {
     $date = $_POST['date'];
     $time = $_POST['time'];
     // note how all business or domain logic is left to the model part of MVC
     // thus the responsibility of the controller is reduced to contact the appropriate model object
     // and to select the appropriate view to render data
     if (TicketService::buyTicket($date, $time, $visa)) {
         header("Location: ../views/ConfirmationView.php?date={$date}&time={$time}");
     } else {
         header('Location: ../views/ErrorView.php');
     }
 }