コード例 #1
0
        private void UserCreateUC_UserCreated(object sender, EventArgs e)
        {
            User user = (e as UserEventArgs).User;

            this.users.Add(user);
            using (var db = new GriffonWpfContext())
            {
                db.Users.Add(user);
                db.SaveChanges();
            }
        }
コード例 #2
0
        private void RemoveItem_HaveToRemoved(object sender, EventArgs e)
        {
            User user = (sender as RemoveItemCommand).ToRemoved as User;

            this.users.Remove(user);
            using (var db = new GriffonWpfContext())
            {
                db.Entry(user).State = System.Data.Entity.EntityState.Deleted;
                db.SaveChanges();
            }
        }
コード例 #3
0
        private void LoadItems()
        {
            //this.currentPage.TxtB1.Text = "Bonjour";
            using (var db = new GriffonWpfContext())
            {
                foreach (var item in db.Users.ToList())
                {
                    users.Add(item);
                }
            }

            this.currentPage.listViewUsers.ItemsSource = users;

            this.RemoveItem = new RemoveItemCommand();
        }