/** * Creates a new ProductUom model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new ProductUom(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id_product' => $model->id_product, 'id_uom' => $model->id_uom]); } else { return $this->render('create', ['model' => $model]); } }
/** * Updates an existing Product model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $dPost = Yii::$app->request->post(); if (isset($dPost['ProductUom'])) { $modelDtl = new ProductUom(); $modelDtl->load($dPost); if (!$modelDtl->save()) { print_r($modelDtl->errors); } } if ($model->load($dPost) && $model->save()) { return $this->redirect(['view', 'id' => $model->id_product]); } else { return $this->render('update', ['model' => $model]); } }