public function actionCreate()
{
$form = new BrandForm();
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
try {
$brand = $this->service->create($form);
return $this->redirect(['view', 'id' => $brand->id]);
} catch (\DomainException $e) {
Yii::$app->errorHandler->logException($e);
Yii::$app->session->setFlash('error', $e->getMessage());
}
}
return $this->render('create', [
'model' => $form,
]);
}