/**
  * Creates a new Answer model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Answer();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Answer model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * 
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Answer();
     $post = Yii::$app->request->post();
     if (isset($post['Answer']['content']) && isset($post['Answer']['askId'])) {
         $model->load($post);
         $model->userId = Yii::$app->user->identity->getId();
         $model->createTime = date('Y-m-d H:i:s', time());
         $model->status = 1;
         $model->helpNum = 0;
         if ($model->save()) {
             $main = Main::findOne($post['Answer']['askId']);
             $main->status = 2;
             $main->save();
         }
     }
     return $this->redirect(['/main/view', 'id' => $post['Answer']['askId']]);
 }