public IActionResult Get(int breedId)
        {
            var breed = repository.GetBreedById(breedId);

            if (breed != null)
            {
                return(Ok(mapper.Map <IEnumerable <BreedCharacteristic>, IEnumerable <BreedCharacteristicViewModel> >(breed.BreedCharacteristics)));
            }
            return(NotFound());
        }
Ejemplo n.º 2
0
        public IActionResult Breed(int id)
        {
            var breed  = repository.GetBreedById(id);
            var result = mapper.Map <Breed, BreedViewModel>(breed);

            return(View(result));
        }
Ejemplo n.º 3
0
 public IActionResult Get(int id)
 {
     try
     {
         var breed = repository.GetBreedById(id);
         if (breed != null)
         {
             return(Ok(mapper.Map <Breed, BreedViewModel>(breed)));
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception ex)
     {
         logger.LogError($"Failed to get breed: {ex}");
         return(BadRequest("Failed to get breed"));
     }
 }