Beispiel #1
0
        /// <summary>
        /// Obsługa dodawania nowych użytkowników do bazy
        /// </summary>
        private void insertBtn_Click(object sender, RoutedEventArgs e)
        {
            member newMember = new member()
            {
                name   = nameTextBox.Text,
                gender = gendercomboBox.Text
            };

            _db.members.Add(newMember);
            _db.SaveChanges();
            MainWindow.datagrid.ItemsSource = _db.members.ToList();
            this.Hide();
        }
Beispiel #2
0
        /// <summary>
        /// Obsługa aktualizacji użytkowników w bazie
        /// </summary>
        private void updateBtn_Click(object sender, RoutedEventArgs e)
        {
            member updateMember = (from m in _db.members
                                   where m.id == Id
                                   select m).Single();

            updateMember.name   = nameTextBox.Text;
            updateMember.gender = gendercomboBox.Text;

            _db.SaveChanges();
            MainWindow.datagrid.ItemsSource = _db.members.ToList();
            this.Hide();
        }