コード例 #1
0
        public IActionResult DeleteAnimal(int animalId, int shelterId)
        {
            var shelter = _dataAccess.GetShelterById(shelterId);
            var animal  = _dataAccess.GetAnimalByShelterAndId(animalId, shelterId);

            if (shelter == null || animal == null)
            {
                return(NotFound("404 animal and/ or schelter are not found"));
            }
            _dataAccess.DeleteAnimal(animalId, shelterId);
            return(Ok(shelter));
        }
コード例 #2
0
        //[Authorize]
        public IActionResult DoDeleteAnimal(int shelterId, int animalId)
        {
            Animal pickedAnimal = _dataAccess.DeleteAnimal(shelterId, animalId);

            return(pickedAnimal == default(Shared.Animal) ? (IActionResult)NotFound("No animal found with these parameters") : Ok(pickedAnimal));
        }
コード例 #3
0
 public IActionResult DeleteAnimal(string shelterId, string animalId)
 {
     _dataAccess.DeleteAnimal(shelterId, animalId);
     return(Ok("Deleted Animal"));
 }