예제 #1
0
        //Longer time
        private void Btn_upadte_Click(object sender, RoutedEventArgs e)
        {
            int index = listViewRent1.SelectedIndex;

            if (index > -1)
            {
                Order order1 = new Order();
                order1 = (Order)listViewRent1.SelectedItem;

                Rent wypozyczenia1 = db.Rent.Find(order1.id_rent);

                wypozyczenia1.DateReturn = wypozyczenia1.DateReturn.AddDays(30);

                db.Entry(wypozyczenia1).State = EntityState.Modified;
                db.SaveChanges();

                ShowList(wys);
            }
        }
예제 #2
0
        //Edit Title
        private void btn_EditTitle_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                books1.Title = txt_title.Text;


                db.Entry(books1).State = EntityState.Modified;
                db.SaveChanges();

                MessageBox.Show("Zedytowano");
            }catch (SqlException f)
            {
                MessageBox.Show(f.Message);
            }
            catch (Exception f)
            {
                MessageBox.Show(f.Message);
            }
        }
예제 #3
0
        //Edytowanie autora
        private void Btn_edytuj_autora_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                author1.FirstName = txt_name.Text;
                author1.Surename  = txt_surename.Text;

                db.Entry(author1).State = EntityState.Modified;
                db.SaveChanges();
                frame1.Content = new Autorzy_Page(frame1, db);
            }
            catch (SqlException f)
            {
                MessageBox.Show(f.Message);
            }
            catch (FormatException f)
            {
                MessageBox.Show(f.Message);
            }
        }