public async Task <MissedClassManageViewModel> GetManageViewModelAsync() { var classDisplayModels = await GetDisplayModelsAsync(); var students = await _studentApi.GetAll(); var viewModel = new MissedClassManageViewModel { Classes = classDisplayModels.ToList(), Students = students, }; return(viewModel); }
public async Task <IEnumerable <StudentViewModel> > GetStudentListAsync() { var students = await _studentApi.GetAll(); // Unable to do this using Select because i'm getting error of running second operation // Before first was completed var list = new List <StudentViewModel>(); foreach (var student in students) { list.Add(new StudentViewModel { Id = student.Id, FirstName = student.FirstName, LastName = student.LastName, Address = student.Address, GroupName = await GetGroupNameAsync(student.Id), }); } return(list); }