public void insertNewCover(GambarDVD_Class cover) { int id_gambar = cover.Id_gambar; int id_dvd = cover.Id_dvd; string url_gambar = cover.Url_gambar; string query = "INSERT INTO tb_gambar_dvd VALUES (" + id_gambar + ",'" + id_dvd + "','" + url_gambar + "');"; OpenConnection(); var hasil = myConn.Execute(query); closeConnection(); }
public void coverDVD(GambarDVD_Class cover) { string sURL = cover.Url_gambar; WebRequest req = WebRequest.Create(sURL); //jalur untuk mengakses url WebResponse res = req.GetResponse(); Stream imgStream = res.GetResponseStream(); // Image Cover = Image.FromStream(imgStream); //generate image dari url imgStream.Close(); var hasil = myConn.Execute(sURL); closeConnection(); }
public GambarDVD_Class getCoverByIDDVD(int id) { try { string query = "SELECT * FROM tb_gambar_dvd where id_dvd=" + id + ""; OpenConnection(); GambarDVD_Class hasil = myConn.Query <GambarDVD_Class>(query, new { id_dvd = id }).FirstOrDefault(); closeConnection(); return(hasil); } catch (Exception ex) { throw ex; } }