public function actionBook() {
$data = $_POST['Book'];
$result = $this->saveBook($data);
}
public function actionTest() {
$data = [
'title' => 'Test title',
'desctiption' => 'Test description'
];
$result = $this->saveBook($data);
}
protected function saveBook($data) {
$model = new Book();
if ($model->load($data, '') && $model->validate()) {
retrun $model->save();
} else {
return false;
}
}