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(); }
public static void Delete(User user) { DBContext.Current.Delete<User>(x => x.id == user.id); }
public static void Update(User user, UpdateDefinition<User> update) { DBContext.Current.Update<User>(x => x.id == user.id, update); }
public static void Add(User user) { DBContext.Current.Add<User>(user); }