private void DisplayUsers() { this.dgvUsers.DataSource = null; this.dgvUsers.DataSource = _usersBL.GetList(); this.dgvUsers.Refresh(); ConfigureDgvUsers(); }
private void btn_DeleteAward_Click(object sender, EventArgs e) { var award = dataGridView2.CurrentRow?.DataBoundItem as Award; var form = new DeleteAward(); if (form.ShowDialog() == DialogResult.OK && (award != null)) { awardBL.Delete(award); foreach (var user in userBL.GetList()) { user.DeleteAward(award.Title); } DisplayUsers(); DisplayAwards(); } }
private void EditUser() { if (ctrGridUser.SelectedCells.Count > 0) { User user = (User)ctrGridUser.SelectedCells[0].OwningRow.DataBoundItem; UserForm form = new UserForm(user, listOfAwards.GetList()); if (form.ShowDialog() == DialogResult.OK) { user.FirstName = form.FirstName; user.LastName = form.LastName; user.DateOfBirth = form.DateOfBirth; user.Awards = form.ListOfAwards; ctrGridUser.DataSource = null; ctrGridUser.DataSource = listOfUsers.GetList(); } } }
private void EditUser() { if (ctrGridUser.SelectedCells.Count > 0) { int id = (int)ctrGridUser.Rows[ctrGridUser.SelectedCells[0].RowIndex].Cells[4].Value; User user = new User(); foreach (User us in listOfUsers.GetList()) { if (us.Id == id) { user = us; } } UserForm form = new UserForm(user, listOfAwards.GetList()); if (form.ShowDialog() == DialogResult.OK) { user.FirstName = form.FirstName; user.LastName = form.LastName; user.DateOfBirth = form.DateOfBirth; user.Awards = form.ListOfAwards; listOfUsers.Edit(user); DisplayUsers(); } } }
private void UpdateUserDataGridView() { ctlUsers.DataSource = null; ctlUsers.DataSource = userService.GetList(); }
// GET: User public ActionResult Index() { ViewBag.HeaderText = "Users list"; return(View(users.GetList().Select(ConvertUser))); }
// GET: User public ActionResult Index() { return(View(listOfUsers.GetList())); }