public bool Delete(DeleteCategoryRequest request)
        {
            var delete = _context.Categories.Where(w => w.category_id == request.category_id).FirstOrDefault();

            if (delete != null)
            {
                _context.Remove(delete);
                _context.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public async Task <ActionResult> DeleteCategory(string id)
        {
            await _categoryContext.Remove(id);

            return(RedirectToAction("Index"));
        }