public bool AddCategory(CategoryDto categoryDto)
 {
     try
     {
         return(_category.AddCategory(categoryDto));
     }
     catch (Exception)
     {
         throw;
     }
 }
        public HttpResponseMessage PostCategory([FromBody] DataModel model)
        {
            if (String.IsNullOrEmpty(model.data) || String.IsNullOrWhiteSpace(model.data))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new { Message = "Invalid input" }));
            }

            var categoryExists = _categoryDal.GetAllCategories().Any(c => c.Name == model.data);

            if (categoryExists)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new { Message = "Category already exists" }));
            }

            _categoryDal.AddCategory(model.data);
            return(Request.CreateResponse(HttpStatusCode.Created, new { Message = "Category has been created" }));
        }