public async Task <IActionResult> Index() { ICollection <Director> directors = await _directors.GetAll(); var listingResults = directors .Select(director => new DirectorIndexListingModel { Id = director.Id, Name = director.Name }); var model = new DirectorIndexModel() { Directors = listingResults }; return(View(model)); }
private async Task PopulateDirectorDropDownList(object selectedDirector = null) { ICollection <Director> allDirectors = await _directors.GetAll(); ViewBag.DirectorId = new SelectList(allDirectors, "Id", "Name", selectedDirector); }