public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model]);
 }
 /**
  * Saves the contact information in the database
  */
 public function sendAction()
 {
     if ($this->request->isPost() != true) {
         return $this->forward('contact/index');
     }
     $form = new ContactForm();
     $contact = new Contact();
     // Validate the form
     $data = $this->request->getPost();
     if (!$form->isValid($data, $contact)) {
         foreach ($form->getMessages() as $message) {
             $this->flash->error($message);
         }
         return $this->forward('contact/index');
     }
     if ($contact->save() == false) {
         foreach ($contact->getMessages() as $message) {
             $this->flash->error($message);
         }
         return $this->forward('contact/index');
     }
     $this->flash->success('Thanks, we will contact you in the next few hours');
     return $this->forward('index/index');
 }