예제 #1
0
        public void Add(GroupSubjectTeacherRelationDTO relation)
        {
            try
            {
                ValidateModule.ValidateStudent(relation.GroupId);
                ValidateModule.ValidateSubject(relation.SubjectId);
                ValidateModule.ValidateTeacher(relation.TeacherId);
                GroupSubjectRelation groupSubjectRelation =
                    AutoMap <GroupSubjectTeacherRelationDTO, GroupSubjectRelation> .Map(relation);

                Database.GroupSubjectRelations.Add(groupSubjectRelation);
                Database.Commit();
            }
            catch (ValidationException)
            {
                throw;// new ValidationException(ex.Message, ex.Property);
            }
        }
예제 #2
0
        public GroupSubjectRelation ValidateGroupSubjectTeacherRelation(int?relationId)
        {
            if (relationId == null || relationId == 0)
            {
                throw new ValidationException("Задан неверный Id связи.", "");
            }
            GroupSubjectRelation findingRelation =
                _database.GroupSubjectRelations
                .GetById((int)relationId);

            try
            {
                return(ValidateGroupSubjectTeacherRelation(findingRelation));
            }
            catch (ValidationException)
            {
                throw;
            }
        }
예제 #3
0
 public GroupSubjectRelation ValidateGroupSubjectTeacherRelation(GroupSubjectRelation relation) =>
 relation ?? throw new ValidationException("Связь не найдена", "");