public IActionResult Del(int id) { bool b = dal.Delete(id); if (b) { return(Content("Delete Success!")); } return(Content("Delete falied!")); }
protected void btnDelete_OnServerClick(object sender, EventArgs e) { string categoryName = Request.Form["categoryname"]; int categoryId = _categoryDal.GetCategoryID(categoryName); _categoryDal.Delete(new Category { CategoryID = categoryId, }); End("Category Deleted!"); }
public string Delete(int entityId) { try { if (entityId < 1) { return("Kategori Bilgileri Hatalı"); } return(categoryDal.Delete(entityId)); } catch (Exception ex) { return(ex.Message); } }
public bool Delete(int id) { _categoryDal.Delete(_categoryDal.Get(s => s.Id == id)); return(true); }
public ReturnValue Delete(string ids) { ReturnValue retValue = new ReturnValue(); string[] categoryIdArr = ids.Split(new Char[] { ',' }); using (CategoryDal dal = new CategoryDal()) { foreach (string item in categoryIdArr) { if (dal.Delete(item)) { retValue.PutValue("ok", retValue.GetInt("ok")); } else { retValue.PutValue("error", retValue.GetInt("error")); } } } if (retValue.GetInt("error") != 0) { retValue.IsExists = false; retValue.Message = string.Format("删除分类失败,成功{0},失败{1}!", retValue.GetInt("ok"), retValue.GetInt("error")); } else { retValue.IsExists = true; retValue.Message = "删除分类成功!"; ClearCache();//清除缓存 } return retValue; }