public async Task <ActionResult <CategoryDTO> > DeleteCategory(int id) { var category = await categoryAppService.GetCategoryByIdAsync(id); if (category.Id == 0) { return(NotFound()); } await categoryAppService.DeleteCategoryAsync(category.Id);; return(Ok()); }
public JsonResult DelCategory(int id = 0) { bool status = false; string msg = ""; try { if (id > 0) { _categoryAppService.DeleteCategoryAsync(new EntityDto(id)); status = true; } } catch (Exception e) { msg = "-1"; status = false; } return(Json(new { success = status })); }