コード例 #1
0
        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();
        }
コード例 #2
0
        private void insertBtn_Click_1(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();
        }