示例#1
0
 public ActionResult Delete(int id)
 {
     _OfficeService.Delete(new Office {
         Id = id
     });
     return(RedirectToAction("Index"));
 }
示例#2
0
 public ActionResult ConfirmDelete(string id)
 {
     if (Session["uname"] != null)
     {
         officeService.Delete(id);
         return(RedirectToAction("Index", "Office"));
     }
     return(RedirectToAction("Index", "Home"));
 }
示例#3
0
        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();
        }
示例#4
0
        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"));
            }
        }
示例#5
0
 public ActionResult ConfirmDelete(string id)
 {
     officeService.Delete(id);
     return(RedirectToAction("Index", "Office"));
 }