diff options
1 files changed, 30 insertions, 0 deletions
| -rw-r--r-- | src/controllers/EditOfferController.php | 30 |
diff --git a/src/controllers/EditOfferController.php b/src/controllers/EditOfferController.php new file mode 100644 index 0000000..ae49c5b --- /dev/null +++ b/src/controllers/EditOfferController.php @@ -0,0 +1,30 @@ +<?php +include_once('controllers/BaseController.php'); +include_once('models/JobOffer.php'); +include_once('models/Company.php'); +include_once('controllers/DashboardController.php'); + +class EditOfferController extends BaseController { + private static $job; + private static $companies; + + public static function get() { + self::$job = JobOffer::getFromDBById($_POST['jobId']); + self::$companies = Company::getAllFromDB(); + include "views/edit-offer.php"; + } + + public static function put() { + $newJobOffer = new JobOffer($_POST['title'], $_POST['description'], $_POST['company'], $_POST['salary']); + $newJobOffer->id = $_POST['id']; + JobOffer::updateFromDB($newJobOffer); + + DashboardController::get(); + } + + public static function delete() { + JobOffer::deleteFromDB($_POST['jobId']); + + DashboardController::get(); + } +} |
