public async Task <bool> AddAttendence(string lectureCode, List <int> joinedUserIds, int week) { List <UserInfoDto> AllUsersInLecture = await _lectureRepository.GetStudentsByLecture(lectureCode); List <Attendence> AttendenceList = new List <Attendence>(); foreach (UserInfoDto user in AllUsersInLecture) { Attendence attendence = new Attendence(); attendence.week = week; attendence.user_id = user.id; attendence.lecture_code = lectureCode; attendence.status = joinedUserIds.Contains(user.id) ? AttendenceConstants.JOINED : AttendenceConstants.NOT_JOINED; AttendenceList.Add(attendence); } return(await _attendenceRepository.AddAttendence(AttendenceList)); }
public async Task <List <UserInfoDto> > GetStudentsByLecture(string lectureCode) { return(await _lectureRepository.GetStudentsByLecture(lectureCode)); }