public async Task <IActionResult> Details(int?id) { if (id == null) { return(this.NotFound()); } var animal = await _animalRepository.GetByIdAsync(id.Value); if (animal == null) { return(this.NotFound()); } animal.Breed = await _specieRepository.GetBreedByIdAsync(animal.BreedId); if (animal.Breed == null) { return(this.NotFound()); } animal.Breed.Specie = await _specieRepository.GetSpecieAsync(animal.Breed); if (animal.Breed.Specie == null) { return(this.NotFound()); } var model = _converterHelper.ToDetailsViewModel(animal); return(View(model)); }
public async Task <IActionResult> EditBreed(int?id) { if (id == null) { return(NotFound()); } var breed = await _specieRepository.GetBreedByIdAsync(id.Value); if (breed == null) { return(NotFound()); } var model = _converterHelper.ToEditBreedViewModel(breed); return(View(model)); }