public ActionResult Delete(int id) { var currentAward = awards.GetList().FirstOrDefault(u => u.Id == id); if (currentAward != null) { awards.Delete(currentAward); } return(RedirectToAction("Index")); }
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(); } }