コード例 #1
0
        public async Task <IEnumerable <Attendance> > GetAttendancesAtWorkshopAsync(int workshopId)
        {
            if (workshopId <= 0)
            {
                throw new ArgumentException($"Argument {nameof(workshopId)} can't be less or equal zero!");
            }

            int groupId = (await workshopRepository.GetWorkshopAsync(workshopId)).GroupId;

            var students = await groupRepository.GetStudentsAsync(groupId);

            var attendances = new List <Attendance>();

            foreach (var student in students)
            {
                var attendance = (await workshopRepository.GetStudentAttendanceAsync(workshopId, student.Id)).ToAttendance();

                attendances.Add(attendance);
            }

            return(attendances);
        }