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()); }
public IActionResult Breed(int id) { var breed = repository.GetBreedById(id); var result = mapper.Map <Breed, BreedViewModel>(breed); return(View(result)); }
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")); } }