public async Task <IEnumerable <SubjectDto> > GetTeacherCurrentSemesterGroupCoursesAsync(int teacherId, int groupId) { var semesterData = SemestersHelper.IdentifySemester(DateTime.Now); return(await GetTeacherSemesterGroupCoursesAsync(teacherId, semesterData.year, semesterData.semester, groupId) .ConfigureAwait(false)); }
public async Task <IEnumerable <SemesterSubjectDto> > GetStudentGroupCurrentSemesterSubjects(int studentId) { var student = await _studentsService.GetStudentAsync(studentId).ConfigureAwait(false); if (student == null) { throw new ResourceNotFoundException($"Студент {studentId} не знайдений"); } var semesterData = SemestersHelper.IdentifySemester(DateTime.Now); return(await GetGroupSemesterSubjects(student.Group.Id, semesterData.year, semesterData.semester).ConfigureAwait(false)); }
public async Task <GroupDto> CreateGroupAsync(GroupDto group, DateTime educationStartedAt) { using (var transaction = await _groupsUnitOfWork.BeginTransactionAsync().ConfigureAwait(false)) { var newGroup = _mapper.Map <Group>(group); _groupsUnitOfWork.Repository.Add(newGroup); await _groupsUnitOfWork.SaveChangesAsync().ConfigureAwait(false); var groupSemesters = SemestersHelper.GenerateSemesters(educationStartedAt.Year).ToList(); groupSemesters.ForEach(s => { s.GroupId = newGroup.Id; }); await _groupSemestersService.CreateGroupSemestersAsync(groupSemesters).ConfigureAwait(false); transaction.Commit(); return(await GetGroupAsync(newGroup.Id).ConfigureAwait(false)); } }