public string Update(CategoryDto category)
        {
            if (!category.IsValid())
            {
                return("Invalid category");
            }

            bool isUpdated = categoryService.Update(category);

            return(isUpdated ? "Category updated successfully." : "Failed to update the category");
        }
        public string Create(CategoryDto category)
        {
            if (!category.IsValid())
            {
                return("Invalid category");
            }

            bool isCreated = categoryService.Create(category);

            return(isCreated ? "Category added successfully." : "Failed to create the category.");
        }
        public IActionResult Create([FromBody] CategoryDto category)
        {
            if (!category.IsValid())
            {
                return(BadRequest());
            }

            if (categoryService.Create(category))
            {
                return(NoContent());
            }

            return(BadRequest());
        }
        public IActionResult Update([FromRoute] int id, [FromBody] CategoryDto category)
        {
            if (!category.IsValid())
            {
                return(BadRequest());
            }

            category.Id = id;

            if (categoryService.Update(category))
            {
                return(NoContent());
            }

            return(BadRequest());
        }