public async Task <ShowSubjectsAdminView> ShowSubjects() { var subjects = await _subjectRepository.GetAll() as List <Subject>; ShowSubjectsAdminView result = _subjectMapper.MapAllSubjectsToViewModel(subjects); return(result); }
public ShowSubjectsAdminView MapAllSubjectsToViewModel(List <Subject> subjects) { var viewModel = new ShowSubjectsAdminView(); foreach (Subject subject in subjects) { var viewModelItem = new ShowSubjectsAdminViewItem(); viewModelItem.Id = subject.Id; viewModelItem.Name = subject.Name; viewModel.Subjects.Add(viewModelItem); } return(viewModel); }
public async Task <IActionResult> ShowSubjects() { ShowSubjectsAdminView result = await _adminService.ShowSubjects(); return(View(viewName: "Subjects/Subjects", result)); }