Esempio n. 1
0
        public async Task <AddAttendeesViewModel> GetAddAttendeesViewModelAsync(int workDayId)
        {
            string mentorId = HttpContext.Current.User.Identity.GetUserId();
            IEnumerable <StudentDTO> mentorsAllStudents = await studentService.GetByMentorId(mentorId);

            IEnumerable <AttendanceDTO> attendances = await attendanceService.GetByWorkDayId(workDayId);

            List <StudentDTO> presentStudents = new List <StudentDTO>();

            foreach (var attendance in attendances)
            {
                presentStudents.Add(attendance.Student);
            }

            IEnumerable <StudentDTO> notPresentStudents = mentorsAllStudents.Except(presentStudents);
            var viewModelData = new AddAttendeesViewData(notPresentStudents);
            var viewModel     = viewModelFactory.CreateView <AddAttendeesViewData, AddAttendeesViewModel>(viewModelData);

            return(viewModel);
        }