public void Save(User user) { if (user.ID == 0) { Insert(user); } else { Update(user); } }
private void toolStripButtonAdd_Click(object sender, EventArgs e) { User user = new User(); FormAddEditUser formAddUser = new FormAddEditUser(user); if (formAddUser.ShowDialog() == DialogResult.OK) { UsersRepository usersRepository = new UsersRepository(); usersRepository.Save(user); BindControls(); } }
public FormCalls(User user) { InitializeComponent(); this.user = user; BindControls(); }
private void Update(User user) { dataBase.Entry(user).State = EntityState.Modified; dataBase.SaveChanges(); }
private void Insert(User user) { dataBase.Users.Add(user); dataBase.SaveChanges(); }
public void Delete(User user) { dataBase.Entry(user).State = EntityState.Deleted; dataBase.SaveChanges(); }
public FormAddEditUser(User user) { InitializeComponent(); this.user = user; }
public FormAddEditCall(Call call, User user) { InitializeComponent(); this.call = call; this.user = user; }