load->model(array('barang_model')); } function a_barang_get() { if(!$this->get('id')) { $this->response(NULL, 400);} else { $query = $this->barang_model->get_barang_by($this->get('id')); if($query) { $this->response($query, 200);} else { $this->response(array('error' => 'User could not be found'), 404); } } } function all_barang_get() { $query = $this->barang_model->get_barang_all(); if($query) { $this->response($query, 200);} else { $this->response(array('error' => 'User could not be found'), 404); } } function add_barang_post() { $data = array( 'id' => '', 'nama' => $this->post('nama_barang'), 'harga' => $this->post('harga')); $quer = $this->barang_model->simpan_barang($data); if($quer) { $this->response(array( 'succes' => 'yes'), 200); } else { $this->response($quer, 404); } } function update_barang_post(){ $data = array( 'id' => '', 'nama'=> $this->post->('nama_barang'), 'harga'=> $this->post('harga')); } /* function update_barang_post() { $data = array( 'nama' => $this->post('nama'), 'harga' => $this->post('harga')) $id = $this->get('id'); $query = $this->barang_model->update_barang($data, $id); $this->response($query, 200); } function del_barang_delete(){ $id = $this->get('id'); $query = $this->mbarang->del_barang($id); echo ""; $this->response($query, 200); } */ }