public async Task <ActionResult <Category> > DeleteCategory(Guid id)
        {
            var category = await _categoryService.DeleteCategoryAsync(id);

            if (category == null)
            {
                return(NotFound());
            }

            return(category);
        }
Example #2
0
        public async Task <IActionResult> OnPost(Guid id)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            await _categoryService.DeleteCategoryAsync(id);

            return(RedirectToPage("./Categories"));
        }
Example #3
0
        public async Task <ActionResult> DeleteCategory(int id)
        {
            var category = await _categoryServices.GetCategoryAsync(id);

            if (category == null)
            {
                return(NotFound());
            }
            var result = await _categoryServices.DeleteCategoryAsync(category);

            /*_context.Categories.Remove(category);
             * await _context.SaveChangesAsync();*/

            return(Ok(result.DeletedEntity));
        }
Example #4
0
        public async Task <IActionResult> Delete(int id)
        {
            await _categoryServices.DeleteCategoryAsync(id);

            return(Ok());
        }