private async Task <List <MissedClassViewModel> > GetMissedClassViewModelsAsync(IEnumerable <MissedClass> missedClasses) { var viewModels = new List <MissedClassViewModel>(); foreach (var missedClass in missedClasses) { var group = await _studentApi.GetStudentGroupAsync(missedClass.StudentId); var student = await _studentApi.GetByIdAsync(missedClass.StudentId); var cls = await _classesApi.GetByIdAsync(missedClass.ClassId); var subject = await _subjectApi.GetByIdAsync(cls.SubjectId); viewModels.Add(new MissedClassViewModel { Id = missedClass.Id, ClassId = missedClass.ClassId, Date = cls.StartDate, GroupName = group.Name, StudentId = missedClass.StudentId, StudentName = student.FirstName + " " + student.LastName, SubjectName = subject.Name, }); } return(viewModels); }
public async Task <StudentManageViewModel> GetViewModel(int studentId) { var model = new StudentManageViewModel { Groups = await _groupApi.GetAll(), Student = await _studentApi.GetByIdAsync(studentId), }; return(model); }