Esempio n. 1
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);
        }