public override ProfilResmi IstekGetir(int kullaniciId) { string commandText = "sp_ProfilResmiIstekGetir @id"; ProfilResmi profilResmi = new ProfilResmi(); SqlConnection _sqlConnection = new SqlConnection(yol); if (_sqlConnection.State == ConnectionState.Closed) { _sqlConnection.Open(); } SqlCommand _sqlCommand = new SqlCommand(commandText, _sqlConnection); _sqlCommand.Parameters.AddWithValue("@id", kullaniciId); SqlDataReader reader = _sqlCommand.ExecuteReader(); while (reader.Read()) { profilResmi.ResimAdi = reader["ResimAdi"].ToString(); profilResmi.KullaniciId = Convert.ToInt32(reader["KullaniciId"]); profilResmi.ResimId = Convert.ToInt32(reader["ResimId"]); profilResmi.ResimYolu = reader["ResimYolu"].ToString(); } reader.Close(); _sqlConnection.Close(); return(profilResmi); }
public override void Sil(ProfilResmi veri) { string commandText = "exec sp_ProfilResmiSil @id"; SqlConnection _sqlConnection = new SqlConnection(yol); if (_sqlConnection.State == ConnectionState.Closed) { _sqlConnection.Open(); } SqlCommand _sqlCommand = new SqlCommand(commandText, _sqlConnection); _sqlCommand.Parameters.AddWithValue("@id", veri.ResimId); _sqlCommand.ExecuteNonQuery(); _sqlConnection.Close(); }
public override void Ekle(ProfilResmi veri) { string commandText = "exec sp_ProfilResmiEkle @ResimAdi, @ResimYolu, @KullaniciId"; SqlConnection _sqlConnection = new SqlConnection(yol); if (_sqlConnection.State == ConnectionState.Closed) { _sqlConnection.Open(); } SqlCommand _sqlCommand = new SqlCommand(commandText, _sqlConnection); _sqlCommand.Parameters.AddWithValue("@ResimAdi", veri.ResimAdi); _sqlCommand.Parameters.AddWithValue("@ResimYolu", veri.ResimYolu); _sqlCommand.Parameters.AddWithValue("@KullaniciId", veri.KullaniciId); _sqlCommand.ExecuteNonQuery(); _sqlConnection.Close(); }
public void Sil(ProfilResmi veri) { _profilResmiDal.Sil(veri); }
public void Guncelle(ProfilResmi veri) { _profilResmiDal.Guncelle(veri); }
public void Ekle(ProfilResmi veri) { _profilResmiDal.Ekle(veri); }