//Bolum Sil Method public void BolumSil(BolumEntity Bolum) { SqlCommand cmd = dbHelper.GetSqlCommand(); cmd.CommandText = "DELETE FROM Tbl_Bolum WHERE BolumID = @BolumID"; cmd.Parameters.AddWithValue("@BolumID", Bolum.BolumID); cmd.ExecuteNonQuery(); }
//Bolum Ekle Method public void BolumEkle(BolumEntity Bolum) { SqlCommand cmd = dbHelper.GetSqlCommand(); cmd.CommandText = "Insert Into Tbl_Bolum(BolumAd) Values(@BolumAd)"; cmd.Parameters.AddWithValue("@BolumAd", Bolum.BolumAd); cmd.ExecuteNonQuery(); }
//Bolum Guncelle Method public void BolumGuncelle(BolumEntity Bolum) { SqlCommand cmd = dbHelper.GetSqlCommand(); cmd.CommandText = "UPDATE Tbl_Bolum SET BolumAd = @BolumAd WHERE BolumID = @BolumID"; cmd.Parameters.AddWithValue("@BolumAd", Bolum.BolumAd); cmd.Parameters.AddWithValue("@BolumID", Bolum.BolumID); cmd.ExecuteNonQuery(); }
//Bolum Getir Method public List <BolumEntity> BolumGetir() { SqlCommand cmd = dbHelper.GetSqlCommand(); cmd.CommandText = "SELECT BolumAd FROM Tbl_Bolum"; List <BolumEntity> bolumler = new List <BolumEntity>(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { BolumEntity bolum = new BolumEntity(); bolum.BolumAd = dr["BolumAd"].ToString(); bolumler.Add(bolum); } return(bolumler); }