Exemple #1
0
        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);
        }
Exemple #2
0
        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();
        }
Exemple #3
0
        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();
        }
Exemple #4
0
 public void Sil(ProfilResmi veri)
 {
     _profilResmiDal.Sil(veri);
 }
Exemple #5
0
 public void Guncelle(ProfilResmi veri)
 {
     _profilResmiDal.Guncelle(veri);
 }
Exemple #6
0
 public void Ekle(ProfilResmi veri)
 {
     _profilResmiDal.Ekle(veri);
 }