예제 #1
0
        ///<inheritdoc/>
        public Task AddTeacher(Guid departmentId, Guid teacherId, DepartmentTeacherRelation departmentTeacherRelation)
        {
            DepartmentTeacherRelationEntity departmentTeacherRelationEntity = new DepartmentTeacherRelationEntity
            {
                Id               = departmentTeacherRelation.Id,
                TeachingType     = departmentTeacherRelation.TeachingType,
                IsDepartmentHead = departmentTeacherRelation.IsDepartmentHead,
                TeacherId        = teacherId,
                DepartmentId     = departmentId
            };

            _websiteDbContext.DepartmentTeacherRelations.Add(departmentTeacherRelationEntity);
            return(_websiteDbContext.SaveChangesAsync());
        }
예제 #2
0
        public async Task <Guid> CreateTeacher([FromBody] TeacherFm teacherFm)
        {
            Teacher teacher = new Teacher
            {
                Id             = Guid.NewGuid(),
                Surname        = teacherFm.Surname,
                Name           = teacherFm.Name,
                Patronymic     = teacherFm.Patronymic,
                Degree         = teacherFm.Degree,
                AdditionalInfo = teacherFm.AdditionalInfo,
                PictureId      = teacherFm.PictureId,
            };
            DepartmentTeacherRelation departmentTeacherRelation = new DepartmentTeacherRelation
            {
                Id               = Guid.NewGuid(),
                TeachingType     = teacherFm.TeachingType,
                IsDepartmentHead = false
            };
            await _teacherRepository.CreateTeacher(teacher);

            await _departmentRepository.AddTeacher(CodeSystem.Iu2DepartmentId, teacher.Id, departmentTeacherRelation);

            return(teacher.Id);
        }