Пример #1
0
        public override void Ekle(YorumMetni veri)
        {
            string commandText =
                "exec sp_YorumMetniEkle @YorumId, @PaylasimId, @KullaniciId, @GirilenMetin,@YapilmaZamani";

            SqlConnection _sqlConnection = new SqlConnection(yol);

            if (_sqlConnection.State == ConnectionState.Closed)
            {
                _sqlConnection.Open();
            }

            SqlCommand _sqlCommand = new SqlCommand(commandText, _sqlConnection);



            _sqlCommand.Parameters.AddWithValue("@YorumId", veri.YorumId);
            _sqlCommand.Parameters.AddWithValue("@PaylasimId", veri.PaylasimId);
            _sqlCommand.Parameters.AddWithValue("@KullaniciId", veri.KullaniciId);
            _sqlCommand.Parameters.AddWithValue("@GirilenMetin", veri.GirilenMetin);
            _sqlCommand.Parameters.AddWithValue("@YapilmaZamani", veri.YapilmaZamani);

            _sqlCommand.ExecuteNonQuery();

            _sqlConnection.Close();
        }
Пример #2
0
 public void Ekle(YorumMetni veri)
 {
     if (String.IsNullOrEmpty(veri.YorumId))
     {
         veri.YorumId = Guid.NewGuid().ToString();
     }
     _yorumMetniDal.Ekle(veri);
 }
Пример #3
0
        public override void Sil(YorumMetni veri)
        {
            string commandText =
                "exec sp_YorumMetniSil @YorumId";

            SqlConnection _sqlConnection = new SqlConnection(yol);

            if (_sqlConnection.State == ConnectionState.Closed)
            {
                _sqlConnection.Open();
            }

            SqlCommand _sqlCommand = new SqlCommand(commandText, _sqlConnection);


            _sqlCommand.Parameters.AddWithValue("@YorumId", veri.YorumId);

            _sqlCommand.ExecuteNonQuery();

            _sqlConnection.Close();
        }
Пример #4
0
        public override YorumMetni IstekGetir(string YorumId)
        {
            string commandText = "Exec sp_YorumMetniIstekGetir @id";

            YorumMetni yorumMetni = new YorumMetni();

            SqlConnection _sqlConnection = new SqlConnection(yol);


            if (_sqlConnection.State == ConnectionState.Closed)
            {
                _sqlConnection.Open();
            }

            SqlCommand _sqlCommand = new SqlCommand(commandText, _sqlConnection);



            _sqlCommand.Parameters.AddWithValue("@id", YorumId);

            SqlDataReader reader = _sqlCommand.ExecuteReader();

            while (reader.Read())
            {
                yorumMetni.YorumId       = reader["YorumId"].ToString();
                yorumMetni.PaylasimId    = reader["PaylasimId"].ToString();
                yorumMetni.KullaniciId   = Convert.ToInt32(reader["KullaniciId"]);
                yorumMetni.GirilenMetin  = reader["YorumMetni"].ToString();
                yorumMetni.YapilmaZamani = reader["YapilmaZamani"].ToString();
            }

            reader.Close();
            _sqlConnection.Close();

            return(yorumMetni);
        }
Пример #5
0
 public void Guncelle(YorumMetni veri)
 {
     _yorumMetniDal.Guncelle(veri);
 }
Пример #6
0
 public void Sil(YorumMetni veri)
 {
     _yorumMetniDal.Sil(veri);
 }