Esempio n. 1
0
        public DVD_Class getById(int Id)
        {
            try
            {
                string query = "SELECT * FROM tb_dvd WHERE id_dvd = " + Id + ";";

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

                return(hasil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public void insertNewDVD(DVD_Class dvd)
        {
            try
            {
                int id_dvd        = dvd.Id_dvd;
                int id_movie      = dvd.Id_movie;
                int stock         = dvd.Stock;
                int harga_display = dvd.Harga_display;

                string query = "INSERT INTO tb_dvd VALUES (null,'" + id_movie + "','" + stock + "'" + " ,'"
                               + harga_display + "');";

                OpenConnection();
                var hasil = myConn.Execute(query);
                closeConnection();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }