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);
                    }
                }
            }
        }
예제 #2
0
        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"));
        }
예제 #3
0
        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"));
        }
예제 #5
0
        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());
        }
예제 #6
0
 public IActionResult Delete([FromBody] BlogCategory category)
 {
     try
     {
         _category.Delete(category);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
예제 #7
0
        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 }));
            }
        }
예제 #8
0
 public int Delete([FromBody] CategoryModel model)
 {
     return(_bus.Delete(model));
 }
예제 #9
0
 public bool Delete(string id)
 {
     return(_itemGroupBusiness.Delete(id));
 }
예제 #10
0
        public IHttpActionResult Delete(int categoryId)
        {
            var result = iCategoryBusiness.Delete(categoryId);

            return(Json(result));
        }
예제 #11
0
        public SimpleResponse Delete(int categoryId)
        {
            var result = iCategoryBusiness.Delete(categoryId);

            return(result);
        }
예제 #12
0
 public IHttpActionResult Delete(int id)
 {
     _category.Delete(id);
     return(Ok("Deleted Successfully !"));
 }