Example #1
0
        public AuditTypeOutput Execute(AuditType auditType)
        {
            var tp = _auditTypeRepository.CheckDuplicated(auditType);

            if (tp == null)
            {
                return(_mapper.Map <AuditType, AuditTypeOutput>(_auditTypeRepository.Add(auditType)));
            }
            else
            {
                throw new DuplicateEntityException(auditType.Name, "Ya existe un tipo de auditoria con este nombre y/o código");
            }
        }
        public AuditTypeOutput Execute(AuditType auditType)
        {
            var at = _auditTypeRepository.CheckDuplicated(auditType);

            if (at == null)
            {
                return(_mapper.Map <AuditType, AuditTypeOutput>(_auditTypeRepository.Update(auditType)));
            }
            else
            {
                throw new DuplicateEntityException(auditType.Code, "Ya existe un tipo de auditoria con este código y/o nombre");
            }
        }