Esempio n. 1
0
        public async Task AddWorkDayAttendeesAsync(int workDayId, List <string> attendeeIds)
        {
            if (attendeeIds != null)
            {
                WorkDayDTO workDay = await workDayService.GetByIdAsync(workDayId);

                IEnumerable <StudentDTO> students = await studentService.GetStudentsByIds(attendeeIds);

                foreach (StudentDTO student in students)
                {
                    workDay.Attendances.Add(new AttendanceDTO {
                        Student = student, Come = DateTime.Now
                    });
                }
                await workDayService.SaveChangesAsync();
            }
        }