Esempio n. 1
0
 /// <summary>
 /// Databe update etmek için kullandığımız method.
 /// </summary>
 void updateData()
 {
     using (ntp_chatApplicationEntities1 db = new ntp_chatApplicationEntities1())
     {
         tableChat.name            = txtName.Text;
         tableChat.surname         = txtSrName.Text;
         tableChat.message_text    = txtMessage.Text;
         db.Entry(tableChat).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Database'den veri silmek için kullandığımız method.
        /// </summary>
        void deleteData()
        {
            using (ntp_chatApplicationEntities1 db = new ntp_chatApplicationEntities1())
            {
                //db.Entry
                var entry = db.Entry(tableChat);
                if (entry.State == EntityState.Detached)
                {
                    db.table_chatUsers.Attach(tableChat);
                }
                db.table_chatUsers.Remove(tableChat);
                db.SaveChanges();
                dataGridView();
                clear();

                //tableChat.name = txtName.Text;
                //tableChat.surname = txtSrName.Text;
                //tableChat.message_text = txtMessage.Text;
                //db.table_chatUsers.Remove(tableChat);
                //db.SaveChanges();
            }
        }