public function actionAdd()
 {
     $model = new Users();
     $id = !empty(yii::$app->request->get('id')) ? yii::$app->request->get('id') : 0;
     $item = $model::find()->where(['id' => $id])->asArray()->one();
     if ($item) {
         $this->headerPage = "Редактировать пользователя - " . $item["username"];
     } else {
         $this->headerPage = "Добавить пользователя";
     }
     if (yii::$app->request->isPost) {
         $pathInfo = Yii::$app->request->pathInfo;
         $fields = Yii::$app->request->post();
         if (isset($fields["main"]["id"])) {
             $id = $fields["main"]["id"];
         } else {
             $id = Yii::$app->request->get('id') ? (int) Yii::$app->request->get('id') : 0;
         }
         foreach ($fields["main"] as $index => $value) {
             $model->{$index} = $value;
         }
         $model->attributes = $fields["main"];
         if (!empty(Yii::$app->request->get('id'))) {
             $model->password = "******";
         }
         if ($model->validate()) {
             $data = $model->MakeData($fields["main"]);
             $insert_id = $model->Add($id, $data);
             $this->redirect(Url::to(["/{$pathInfo}", "id" => $insert_id]));
         } else {
             $errors = $model->errors;
             app::PrintPre($errors);
         }
     }
     $interface = $this->MakeInterface($item);
     return $this->render('add', ['interface' => $interface, 'data' => $item]);
 }