/** * Creates a new CongressSchedules model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new CongressSchedules(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Get details of workforce contacts */ public function actionGetcontactdata() { $model1 = new AmgenContactList(); $model2 = new CongressSchedules(); $model1->workforce_id = $_POST['AmgenContactList']['workforce_id']; $wf_id = $model1->workforce_id; $exists = $model1::find()->where(['Name' => $wf_id])->exists(); if ($exists) { $userid = \backend\models\AmgenContactList::find()->where(['Name' => $wf_id])->one(); $userid = $userid['id']; $model2->attendee_id = $userid; $model2->congress_id = $_POST['CongressSchedules']['congress_id']; $congid = $_POST['CongressSchedules']['congress_id']; $sql = "select congress_id,attendee_id from congress_schedules where congress_id='{$congid}' and attendee_id='{$userid}'"; $res = Yii::$app->db->createCommand($sql)->execute(); if ($res == 0) { $model2->save(FALSE); echo "TRUE"; } else { echo "FALSE"; } } else { echo "Exists"; } }