/**
     * Updates an existing Auctions model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     *
     * @throws Exception 404 if invalid data provided
     */
    public function actionUpdate($id)
    {
        $model = Auctions::find()->joinWith([
            'bidsTerms',
            'auctionsCriterias',
            'auctionPreferences'
        ])->where([
            'auctions.id' => $id
        ])->one();

        if($model === null){
            throw new HttpException(404 ,' Not A valid Auction');
        }

        $post = Auction::post();

        if ($model->load($post) && $model->bidsTerms->load($post) && $model->auctionsCriterias->load($post) && $model->auctionPreferences->load($post)) {

            if($model->save() && $model->bidsTerms->save() && $model->auctionsCriterias->save() && $model->auctionPreferences->save()){
                return $this->redirect(['view', 'id' => $model->id]);
            }

        } else {
            return $this->render('update', [
                'model' => $model,
            ]);
        }
    }