// GET: Pets/Delete/5
        public async Task <IActionResult> DeletePet(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var pet = await _petRepository.GetPetAsync(id.Value);

            try
            {
                await _petRepository.DeletePetAsync(id.Value);
            }
            //catch (DbUpdateException dbUpdateException)
            //{
            //    if (dbUpdateException.InnerException.Message.Contains("REFERENCE"))
            //    {
            //        ModelState.AddModelError(string.Empty, "This record have appointments.");
            //    }
            //    else
            //    {
            //        ModelState.AddModelError(string.Empty, dbUpdateException.InnerException.Message);
            //    }
            //}
            catch (Exception exception)
            {
                ModelState.AddModelError(string.Empty, exception.Message);
            }
            return(RedirectToAction($"{nameof(Details)}/{pet.Customer.Id}"));
        }