Exemplo n.º 1
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();
            }
        }
Exemplo n.º 2
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();
            }
        }