コード例 #1
0
        private async Task <SelectList> CreateSemestersSelectList(int?currentId)
        {
            var tmpList = (await semestersRepository.GetSemestersAsync()).Select(s => new CustomSelectListItem()
            {
                Name = s.Name, Id = s.Id
            }).ToList();

            tmpList.Insert(0, new CustomSelectListItem()
            {
                Name = "Без семестра", Id = null
            });
            return(new SelectList(tmpList, "Id", "Name", currentId));
        }
コード例 #2
0
 public async Task <IActionResult> Index()
 {
     return(View(await semestersRepository.GetSemestersAsync()));
 }