예제 #1
0
 public void Save(User user)
 {
     if (user.ID == 0)
     {
         Insert(user);
     }
     else
     {
         Update(user);
     }
 }
예제 #2
0
        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();
            }
        }
예제 #3
0
 public FormCalls(User user)
 {
     InitializeComponent();
     this.user = user;
     BindControls();
 }
예제 #4
0
 private void Update(User user)
 {
     dataBase.Entry(user).State = EntityState.Modified;
     dataBase.SaveChanges();
 }
예제 #5
0
 private void Insert(User user)
 {
     dataBase.Users.Add(user);
     dataBase.SaveChanges();
 }
예제 #6
0
 public void Delete(User user)
 {
     dataBase.Entry(user).State = EntityState.Deleted;
     dataBase.SaveChanges();
 }
예제 #7
0
 public FormAddEditUser(User user)
 {
     InitializeComponent();
     this.user = user;
 }
예제 #8
0
 public FormAddEditCall(Call call, User user)
 {
     InitializeComponent();
     this.call = call;
     this.user = user;
 }