private void RemoveSelectedReward() { if (dgvRewards.SelectedCells.Count > 0) { DelReward form = new DelReward(); if (form.ShowDialog(this) == DialogResult.OK) { Reward reward = (Reward)dgvRewards.SelectedCells[0].OwningRow.DataBoundItem; string del = reward.Title.ToString(); for (int i = 0; i < dgvEmployees.RowCount; i++) { if (dgvEmployees[4, i].Value != null) { if (dgvEmployees[4, i].Value.ToString().Contains(del)) { Employee employee = (Employee)dgvEmployees[4, i].OwningRow.DataBoundItem; // employee.Rewards = employee.Rewards.Replace(del, ""); employee.Rewards.Remove(reward); DisplayEmployee(); } } rewards.Remove(reward); DisplayReward(); DisplayEmployee(); } } } }
private void RemoveReward() { if (dgvRewards.Rows.Count > 0) { var formSureRemove = new FormSureRemove(DeletingItem.Rewrad); if (formSureRemove.ShowDialog(this) == DialogResult.OK) { Reward reward = (Reward)dgvRewards.SelectedCells[0].OwningRow.DataBoundItem; _rewardsBL.Remove(reward); foreach (var user in _usersBL.GetList()) { foreach (var rew in user.Rewards) { if (rew == reward) { user.Rewards.Remove(reward); break; } } } } } }
public IActionResult RemoveReward() { int rewardIdToRemove = int.Parse(Request.Form["rewardIdToRemove"]); _rewardsBL.Remove(new Entites.Reward(rewardIdToRemove, "", "")); return(RedirectToAction("Index")); }
public ActionResult Delete(int rewardId) { var currentReward = rewardsBL.GetList().FirstOrDefault(u => u.ID == rewardId); if (currentReward != null) { rewardsBL.Remove(currentReward); } return(RedirectToAction("Index")); }
private void RemoveReward() { if (dgvRewards.Rows.Count > 0) { var formSureRemove = new FormSureRemove(_QuestionWhenDeletingAnReward); if (formSureRemove.ShowDialog(this) == DialogResult.OK) { Reward reward = (Reward)dgvRewards.SelectedCells[0].OwningRow.DataBoundItem; _rewardsBL.Remove(reward); } } }