コード例 #1
0
        public void insertKeranjang(Keranjang_Class keranjang)
        {
            int id_keranjang = keranjang.Id_keranjang;
            int id_cust      = keranjang.Id_cust;

            string query = "INSERT INTO tb_keranjang VALUES (null," + id_keranjang + ");";

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

            closeConnection();
        }
コード例 #2
0
        public Keranjang_Class getByIdCust(int Id)
        {
            try
            {
                string query = "SELECT id_keranjang FROM tb_keranjang where tb_keranjang.id_cust = " + Id + " ORDER BY id_keranjang DESC Limit 1;";

                OpenConnection();
                Keranjang_Class hasil = myConn.Query <Keranjang_Class>(query, new { id_cust = Id }).FirstOrDefault();
                closeConnection();

                return(hasil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        public Keranjang_Class getById(int Id)
        {
            try
            {
                string query = "SELECT * FROM tb_keranjang WHERE id_keranjang = " + Id + ";";

                OpenConnection();
                Keranjang_Class hasil = myConn.Query <Keranjang_Class>(query, new { id_keranjang = Id }).FirstOrDefault();
                closeConnection();

                return(hasil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }