// GET: SpeciesController/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var specie = await _specieRepository.GetSpecieWithBreedsAsync(id.Value); if (specie == null) { return(NotFound()); } var model = _converterHelper.ToDetailsViewModel(specie); return(View(model)); }
public async Task <IEnumerable <SelectListItem> > GetComboBreedsAsync(int specieId) { var specie = await _specieRepository.GetSpecieWithBreedsAsync(specieId); var list = new List <SelectListItem>(); if (specie != null) { list = specie.Breeds.Select(r => new SelectListItem { Text = r.Name, Value = r.Id.ToString() }).OrderBy(l => l.Text).ToList(); } list.Insert(0, new SelectListItem { Text = "(Select a Breed...)", Value = "0" }); return(list); }