Пример #1
0
        public DetailBarang getByIdDetail(int id)
        {
            string query = "SELECT * FROM detail_barang WHERE ID_DETAIL_BARANG = '" + id + "';";

            OpenConnection();
            DetailBarang hasil = myConn.QuerySingle <DetailBarang>(query);

            closeConnection();

            return(hasil);
        }
Пример #2
0
        public IActionResult PutDetailBarang(string id, [FromBody] DetailBarang value)
        {
            RepositoryDetailBarang RP = new RepositoryDetailBarang();

            try
            {
                RP.updateData(id, value);
                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
Пример #3
0
        public IActionResult PostDetailBarang([FromBody] DetailBarang value)
        {
            RepositoryDetailBarang RP = new RepositoryDetailBarang();

            try
            {
                RP.insertData(value);
                return(Created("", value));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }
Пример #4
0
        public void updateData(string Id, DetailBarang dtl)
        {
            int    _id_detail_barang  = dtl.Id_detail_barang;
            string _id_barang         = dtl.Id_barang;
            string _nomor_seri_detail = dtl.Nomor_seri_detail;
            string _status_detail     = dtl.Status_detail;
            string _keterangan_detail = dtl.Keterangan_detail;

            string query = "UPDATE detail_barang SET ID_BARANG = '" + _id_barang + "', NOMOR_SERI_DETAIL = '" + _nomor_seri_detail + "', STATUS_DETAIL = '" + _status_detail + "', KETERANGAN_DETAIL = '" + _keterangan_detail + "' WHERE ID_DETAIL_BARANG = " + _id_detail_barang + ";";

            OpenConnection();
            var hasil = myConn.Execute(query);

            closeConnection();
        }
Пример #5
0
        public void insertData(DetailBarang dtl)
        {
            int    _id_detail_barang  = dtl.Id_detail_barang;
            string _id_barang         = dtl.Id_barang;
            string _nomor_seri_detail = dtl.Nomor_seri_detail;
            string _status_detail     = dtl.Status_detail;
            string _keterangan_detail = dtl.Keterangan_detail;

            string query = "INSERT INTO detail_barang VALUES (null, '" + _id_barang + "', '" + _nomor_seri_detail + "', '" + _status_detail + "', '" + _keterangan_detail + "');";

            OpenConnection();
            var hasil = myConn.Execute(query);

            closeConnection();
        }