private void btnDelete_Click(object sender, EventArgs e)
 {
     s1.Delete((int)cbSubCategory.SelectedValue);
     GetCategory();
     GetSubCategory();
     GetDataGrid();
 }
Exemple #2
0
        public bool Delete(SubCategory subCategory)
        {
            int rowAffected = _subCategoryRepository.Delete(subCategory);

            bool isSaved = rowAffected > 0;

            return(isSaved);
        }
        public bool Delete(int?id)
        {
            int rowAffected = _Repository.Delete(id);

            bool isDeleted = rowAffected > 0;

            return(isDeleted);
        }
 public ActionResult SubCategoryDelete(string id)
 {
     if (scr.SelectById(id) != null)
     {
         scr.Delete(scr.SelectById(id));
     }
     return(RedirectToAction("Categories"));
 }
        public ActionResult Delete(Guid id)
        {
            try
            {
                altKategoriRepo.Delete(id);
                TempData["OnayMesaji"] = "Silme işlemi başarılıdır";
            }
            catch (Exception)
            {
                TempData["HataMesaji"] = "Silme İşlemi sırasında hata oluştu";
            }

            return(RedirectToAction("Index", "SubCategory", new { area = "Admin" }));
        }
Exemple #6
0
        public async Task <string> DeleteSubCategory(int id)
        {
            string status       = "";
            int    count        = 0;
            int    countProduct = 0;

            if (id > 0)
            {
                using (abuhamzapetstoreEntities db = new abuhamzapetstoreEntities())
                {
                    try
                    {
                        count = (from c in db.tblForthSubCategories
                                 where c.subCat_id == id
                                 select 1).Take(1).SingleOrDefault();

                        countProduct = (from p in db.tblProducts
                                        where p.subCat_id == id
                                        select 1).Take(1).SingleOrDefault();

                        if (count == 0 && countProduct == 0)
                        {
                            await subCategoryRepository.Delete(s => s.subCat_id == id);

                            status = "Deleted";
                        }
                        else
                        {
                            status = "NotDelete";
                        }
                    }
                    catch (Exception ex)
                    {
                        status = ex.Message;
                    }
                }
            }
            return(status);
        }
Exemple #7
0
 public void Delete(int id)
 {
     _subCategoryRepository.Delete(id);
 }
Exemple #8
0
 public void Delete(long?id)
 {
     _subcategoryRepository.Delete(id);
 }