public function deleteBed($bed_id) { $bed = new BedModel($bed_id); $bed_status = $bed->getStatus(); if ($bed_status == OCCUPIED) { $response = array(P_STATUS => STATUS_ERROR, P_MESSAGE => "Cannot remove bed that is currently occupied!"); return $response; } $feedback = $bed->delete(); if (!$feedback) { $response = array(P_STATUS => STATUS_ERROR, P_MESSAGE => "Unable to delete bed!"); return $response; } return $feedback; }
public function switchBed($admission_id, $bed_id) { $admission_model = new AdmissionModel(); $bed = new BedModel($bed_id); $bed_status = $bed->getStatus(); if ($bed_status == OCCUPIED) { $response = array(P_STATUS => STATUS_ERROR, P_MESSAGE => "Cannot assign bed that is currently occupied!"); return $response; } $feedback = $admission_model->switchBed($admission_id, $bed_id); if (!$feedback) { $response = array(P_STATUS => STATUS_ERROR, P_MESSAGE => "Unable to assign bed!"); return $response; } return $feedback; }