public ActionResult Delete(Category category)
        {
            try
            {
                CategoriesDAL categoriesDAL = new CategoriesDAL();
                categoriesDAL.Delete(category);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
 public ActionResult DeleteCategories(int?id)
 {
     if (id != null)
     {
         using (CategoriesDAL service = new CategoriesDAL())
             try
             {
                 service.Delete(id.Value);
                 TempData["Message"] = Helper.MsgBox.GetMsg("success", "Success! ", "Your data has been removed");
             }
             catch (Exception ex)
             {
                 TempData["Message"] = Helper.MsgBox.GetMsg("danger", "Error", ex.Message);
             }
     }
     return(RedirectToAction("Index"));
 }
예제 #3
0
        private void btnDeleteCat_Click(object sender, EventArgs e)
        {
            c.id = int.Parse(txtCatID.Text);

            bool success = dal.Delete(c);

            if (success == true)
            {
                Mymessage mymessage = new Mymessage("Category Successfully Deleted!");
                mymessage.Show();
                Clear();
                DataTable dt = dal.Select();
                GDVCategory.DataSource = dt;
            }
            else
            {
                Mymessage mymessage = new Mymessage("Category Deletion Failed!");
                mymessage.Show();
            }
        }
예제 #4
0
 public ActionResult Delete(int?id)
 {
     if (id != null)
     {
         using (CategoriesDAL service = new CategoriesDAL())
         {
             try
             {
                 service.Delete(id.Value);
                 TempData["Pesan"] = Helpers.KotakPesan.GetPesan("Sukses !",
                                                                 "success", "Data kategori berhasil di hapus !");
             }
             catch (Exception ex)
             {
                 TempData["Pesan"] = Helpers.KotakPesan.GetPesan("Error !",
                                                                 "danger", ex.Message);
             }
         }
     }
     return(RedirectToAction("Index"));
 }
예제 #5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Get the id of the category which we want to delete
            c.id = int.Parse(txtCategoryId.Text);

            //Creating boolian variable to delete the category
            bool success = dal.Delete(c);

            //If the category deleted successfully, then the success value will be true, so checking it
            if (success == true)
            {
                MessageBox.Show("Category Delted Successfully...!");
                Clear();
                //Refresh Datagrid view
                DataTable dt = dal.Select();
                dgvCategories.DataSource = dt;
            }
            else
            {
                MessageBox.Show("Category deletion Failed...!");
                Clear();
            }
        }
예제 #6
0
 public int Delete(int catid)
 {
     return(_dao.Delete(catid));
 }