Пример #1
0
 public function actionDelete($id)
 {
     $paint = Model::findByPK($id);
     try {
         $paint->delete();
         $this->app->flash->success = 'Запись #' . $id . ' успешно удалена';
         $this->redirect('/paint/index');
     } catch (\Exception $e) {
         $this->app->flash->error = $e->getMessage();
     }
 }
Пример #2
0
 public function actionEdit($id)
 {
     $consignment = Model::findByPK($id);
     $post = $this->app->request->post;
     if ($post->count()) {
         try {
             $consignment->fill($post);
             $consignment->save();
             $this->app->flash->success = 'Запись #' . $id . ' успешно изменена';
             $this->redirect('/consignment/index');
         } catch (\Exception $e) {
             $this->data->error = $e->getMessage();
         }
     }
     $this->data->paints = Paint::findAll();
     $this->data->consignment = $consignment;
 }