public ActionResult Delete(int id) { _OfficeService.Delete(new Office { Id = id }); return(RedirectToAction("Index")); }
public ActionResult ConfirmDelete(string id) { if (Session["uname"] != null) { officeService.Delete(id); return(RedirectToAction("Index", "Office")); } return(RedirectToAction("Index", "Home")); }
private void btnDelete_Click(object sender, EventArgs e) { OfficeService officeService = new OfficeService(new CoffeShopContext()); DialogResult dialogResult = MessageBox.Show("Bạn có chắc?", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dialogResult == DialogResult.OK) { if (officeService.Delete(idTable)) { MessageBox.Show("Xóa Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Thất Bại", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } } idTable = ""; btnDelete.Enabled = false; loadData(); }
public ActionResult Delete(int ID) { OfficeService service = new OfficeService(); try { if (ID < 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var office = service.Getbykey(ID); if (office == null) { return(HttpNotFound()); } service.Delete(office.OfficeID); return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error")); } }
public ActionResult ConfirmDelete(string id) { officeService.Delete(id); return(RedirectToAction("Index", "Office")); }