public ActionResult DeleteCategory(int id) { var modelFromRepo = _repository.GetCategoryById(id); if (modelFromRepo == null) { return(NotFound()); } _repository.DeleteCategory(modelFromRepo); _repository.SaveChanges(); return(NoContent()); }