public async Task <ShowStudentsAdminView> ShowStudents() { List <Student> teachers = await _studentRepository.GetAllStudentsByCompany(ApplicationConstants.CurrentCompanyId); ShowStudentsAdminView result = _studentMapper.MapStudentModelsToViewModels(teachers); return(result); }
public ShowStudentsAdminView MapStudentModelsToViewModels(List <Student> model) { var viewModel = new ShowStudentsAdminView(); foreach (Student teacher in model) { var viewModelItem = new StudentShowStudentsAdminViewItem(); viewModelItem.UserName = teacher.UserName; viewModelItem.FullName = $"{teacher.LastName} {teacher.FirstName} {teacher.MiddleName}"; viewModel.Students.Add(viewModelItem); } return(viewModel); }
public async Task <IActionResult> ShowStudents() { ShowStudentsAdminView result = await _adminService.ShowStudents(); return(View(viewName: "Students/Students", result)); }