public void Add(TeacherSubjectRelationDTO relation)
        {
            if (relation == null)
            {
                throw new ValidationException("Связь не найдена", "");
            }
            TeacherSubjectRelation addingRelation =
                AutoMap <TeacherSubjectRelationDTO, TeacherSubjectRelation>
                .Map(relation);

            Database.TeacherSubjectRelations.Add(addingRelation);
            Database.Commit();
        }
Exemplo n.º 2
0
        public TeacherSubjectRelation ValidateTeacherSubjectRelation(int?relationId)
        {
            if (relationId == null || relationId == 0)
            {
                throw new ValidationException("Задан неверный Id связи.", "");
            }
            TeacherSubjectRelation findingRelation =
                _database.TeacherSubjectRelations
                .GetById((int)relationId);

            try
            {
                return(ValidateTeacherSubjectRelation(findingRelation));
            }
            catch (ValidationException)
            {
                throw;
            }
        }
Exemplo n.º 3
0
 public TeacherSubjectRelation ValidateTeacherSubjectRelation(TeacherSubjectRelation relation) =>
 relation ?? throw new ValidationException("Связь не найдена", "");