public ActionResult Edit(AwardViewModel awardModel) { try { awards.Edit(awardModel.ToAward()); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here listOfAwards.Edit(new Award(Convert.ToInt32(collection["AwardId"]), collection["AwardName"], collection["AwardDescription"])); return(RedirectToAction("Index")); } catch { return(View()); } }
private void btn_EditAward_Click(object sender, EventArgs e) { var award = dgv_Awards.CurrentRow?.DataBoundItem as Award; if (award != null) { var form = new AwardForm(award.Title, award.Description); if (form.ShowDialog() == DialogResult.OK) { award.Title = form.Title; award.Description = form.Description; awardBL.Edit(award); DisplayUsers(); DisplayAwards(); } } }
private void EditAward() { if (ctrGridAward.SelectedCells.Count > 0) { int id = (int)ctrGridAward.Rows[ctrGridAward.SelectedCells[0].RowIndex].Cells[2].Value; Award award = new Award(); foreach (Award aw in listOfAwards.GetList()) { if (aw.AwardId == id) { award = aw; } } var form = new AwardForm(award); if (form.ShowDialog() == DialogResult.OK) { award.AwardName = form.AwardName; award.AwardDescription = form.AwardDesc; listOfAwards.Edit(award); DisplayAwards(); } } }