public IActionResult FindPetCatByLikeType([FromBody] string petCatSearch)
        {
            PetCategoryDAO     dao  = new PetCategoryDAO(_context);
            List <PetCategory> list = dao.FindPetCategoryByLikeType(petCatSearch);

            return(new JsonResult(list));
        }
        public IActionResult DeletePetCat([FromBody] string id)
        {
            PetCategoryDAO dao = new PetCategoryDAO(_context);
            PetCategory    dto = _context.PetCategory.Find(id);
            string         msg;

            if (dao.Remove(dto))
            {
                msg = "Delete pet category success";
            }
            else
            {
                msg = "Delete pet category failed. It may contains some other categories.";
            }
            return(new JsonResult(msg));
        }
        public IActionResult UpdatePetCat([FromBody] DTO.PetCategory petCat)
        {
            PetCategoryDAO dao = new PetCategoryDAO(_context);
            PetCategory    dto = new PetCategory
            {
                PetCatId = petCat.PetCatId,
                PetType  = petCat.PetType
            };
            string msg;

            if (dao.Update(dto))
            {
                msg = "Update pet category success";
            }
            else
            {
                msg = "Update pet category failed";
            }
            return(new JsonResult(msg));
        }
        public IActionResult CheckPetCatIDExisted([FromBody] string id)
        {
            PetCategoryDAO dao = new PetCategoryDAO(_context);

            return(new JsonResult(dao.CheckExisted(id)));
        }
        public IActionResult LoadAllPetCategory()
        {
            PetCategoryDAO dao = new PetCategoryDAO(_context);

            return(new JsonResult(dao.FindAllPetCategoryAvailable()));
        }