Exemple #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //usernames must be unique
            if (UserManager.Find(usr => usr.username.Equals(txtName.Text)).Count() > 0)
            {
                MessageBox.Show("This user already exists");
                return;
            }

            string savePath = txtSavePth.Text;
            if (!savePath.EndsWith("\\"))
            {
                savePath = savePath + "\\";
            }

            User addUser = new User(txtName.Text, txtPass.Text, (User.SecurityLevel)cboSecurity.SelectedItem, savePath);

            UserManager.Add(addUser);

            RefreshView();
        }
Exemple #2
0
 public static void Delete(User user)
 {
     DBContext.Current.Delete<User>(x => x.id == user.id);
 }
Exemple #3
0
 public static void Update(User user, UpdateDefinition<User> update)
 {
     DBContext.Current.Update<User>(x => x.id == user.id, update);
 }
Exemple #4
0
 public static void Add(User user)
 {
     DBContext.Current.Add<User>(user);
 }