public HttpResponseMessage DeleteCategory(int id)
        {
            var categoryExists = _categoryDal.GetAllCategories().Any(c => c.Id == id);

            if (!categoryExists)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new { Message = "Category doesn't exist" }));
            }

            _categoryDal.DeleteCategory(id);
            return(Request.CreateResponse(HttpStatusCode.Created, new { Message = "Category has been deleted" }));
        }
예제 #2
0
 public bool Delete(int _id)
 {
     return(_efCategoryDal.DeleteCategory(_id));
 }