예제 #1
0
 public ActionResult Delete(IndustrialSector industrialSector)
 {
     if (!_sectorService.DeleteIndustrialSector(industrialSector))
     {
         return(View(industrialSector));
     }
     return(RedirectToAction("Index"));
 }
예제 #2
0
        private void sectorBindingNavigatorDeleteItem_Click(object sender, System.EventArgs e)
        {
            DialogResult result = MessageBox.Show(this, "Are you sure you want to delete this industrial sector (cannot be undo) ?",
                                                  "Confirm Deletion", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (result == DialogResult.OK)
            {
                if (_sectorService.DeleteIndustrialSector((IndustrialSector)this.sectorsBindingSource.Current))
                {
                    this.sectorsBindingSource.RemoveCurrent();
                }
                else
                {
                    MessageBox.Show(this, "Sorry, we were unable to delete the sector. Try again.",
                                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }