コード例 #1
0
        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));
        }
コード例 #2
0
        private async Task PopulateDirectorDropDownList(object selectedDirector = null)
        {
            ICollection <Director> allDirectors = await _directors.GetAll();

            ViewBag.DirectorId = new SelectList(allDirectors, "Id", "Name", selectedDirector);
        }