Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            UserElements user = new UserElements(tbxId.Text, tbxUsername.Text, tbxPassword.Text, tbxFirstName.Text, tbxLastName.Text, tbxInterests.Text.Split(' ').ToList());

            collection.InsertOne(user);
            ReadAllDocuments();
        }
Ejemplo n.º 2
0
        private void dgUsers_MouseUp(object sender, MouseButtonEventArgs e)
        {
            UserElements user = (UserElements)dgUsers.SelectedItem;

            tbxId.Text        = user.Id;
            tbxUsername.Text  = user.userName;
            tbxPassword.Text  = user.password;
            tbxFirstName.Text = user.first_name;
            tbxLastName.Text  = user.last_name;
            tbxInterests.Clear();
            foreach (var interest in user.interests)
            {
                tbxInterests.AppendText(interest + " ");
            }
        }
Ejemplo n.º 3
0
        public void ReadAllDocuments()
        {
            List <UserElements> list = collection.AsQueryable().ToList <UserElements>();

            dgUsers.ItemsSource = list;
            UserElements user = (UserElements)dgUsers.Items.GetItemAt(0);

            tbxId.Text        = user.Id;
            tbxUsername.Text  = user.userName;
            tbxPassword.Text  = user.password;
            tbxFirstName.Text = user.first_name;
            tbxLastName.Text  = user.last_name;
            tbxInterests.Clear();
            foreach (var interest in user.interests)
            {
                tbxInterests.AppendText(interest + " ");
            }
        }