public async Task <ActionResult <IEnumerable <SectionDTO> > > Get() { var sections = await _sectionService.GetAllAsync(); if (sections != null) { return(Ok(sections)); } return(NoContent()); }
public async Task <IActionResult> Index() { var sections = await _sectionService.GetAllAsync(); var viewModel = new SectionViewModel { Sections = sections }; return(View(viewModel)); }
public async Task <IEnumerable <SelectListItem> > GetSections() { var sections = await _sectionService.GetAllAsync(); var item = new List <SelectListItem> { new SelectListItem() { Value = null, Text = "", Selected = true } }; foreach (var section in sections) { item.Add(new SelectListItem() { Value = section.SectionId.ToString(), Text = section.SectionName }); } return(item); }