private void ButtonDelete_Click(object sender, RoutedEventArgs e) { var obj = (Category)ListCategories.SelectedItem; if (obj == null) { MessageBox.Show("Chưa có mục nào được chọn!", "Delete", MessageBoxButton.OK, MessageBoxImage.Warning); } else if (obj != null) { var confirm = MessageBox.Show("Bạn có chắc chắn muốn xóa danh mục này?", "Delete", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (confirm == MessageBoxResult.OK) { bool isSuccess = _categoryBusiness.Delete(obj.CategoryId); if (isSuccess) { InitializeData(); } else { MessageBox.Show("Xoá không thành công, có thể mục này không được phép xóa.", "Delete", MessageBoxButton.OK, MessageBoxImage.Information); } } } }
public ActionResult DeleteCategory(int id) { var categories = _categoryBusiness.Get(); if (categories.Where(c => c.ParentId == id).Any()) { var category = categories.Where(c => c.ParentId == id); foreach (var item in category) { _categoryBusiness.Delete(item.CategoryId); } } _categoryBusiness.Delete(id); _categoryBusiness.Save(); return(RedirectToAction("CategoryList")); }
public SimpleResponse Delete(CategoryDto dto) { var response = new SimpleResponse(); try { var model = SimpleMapper.Map <CategoryDto, CategoryViewModel>(dto); response = iCategoryBusiness.Delete(model); } catch (Exception ex) { response.ResponseCode = BusinessResponseValues.InternalError; response.ResponseMessage = "Silme iþleminde hata oluþtu."; SimpleFileLogger.Instance.Error(ex); } return(response); }
public IActionResult DeleteCategory(int Id) { var category = categoryBusiness.GetOne(Id); if (category != null) { categoryBusiness.Delete(category); } return(RedirectToAction("CategoryList")); }
public IActionResult DeleteCategory([FromBody] Dictionary <string, object> formData) { string category_id = ""; if (formData.Keys.Contains("category_id") && !string.IsNullOrEmpty(Convert.ToString(formData["category_id"]))) { category_id = Convert.ToString(formData["category_id"]); } _CategoryBusiness.Delete(category_id); return(Ok()); }
public IActionResult Delete([FromBody] BlogCategory category) { try { _category.Delete(category); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult DeletePost(int categoryId) { var response = iCategoryBusiness.Delete(categoryId); if (response.ResponseCode > 0) { return(RedirectToAction("Index")); } else { ModelState.AddModelError(string.Empty, response.ResponseMessage); return(RedirectToAction("Delete", new { categoryId })); } }
public int Delete([FromBody] CategoryModel model) { return(_bus.Delete(model)); }
public bool Delete(string id) { return(_itemGroupBusiness.Delete(id)); }
public IHttpActionResult Delete(int categoryId) { var result = iCategoryBusiness.Delete(categoryId); return(Json(result)); }
public SimpleResponse Delete(int categoryId) { var result = iCategoryBusiness.Delete(categoryId); return(result); }
public IHttpActionResult Delete(int id) { _category.Delete(id); return(Ok("Deleted Successfully !")); }