Exemplo n.º 1
0
        public int AddIncidentType(IncidentTypeDomain incidentType)
        {
            if (incidentType == null)
            {
                throw new NsiArgumentException(ExceptionMessages.ArgumentException);
            }

            return(_incidentTypeRepository.AddIncidentType(incidentType));
        }
Exemplo n.º 2
0
        private int FindOrCreateIncidentType(RuleDomain rule)
        {
            var types = _incidentTypeRepository
                        .GetAllIncidentTypes()
                        .Where(x => x.Name == rule.Name);

            if (types.Any())
            {
                return(types.First().IncidentTypeId);
            }

            return(_incidentTypeRepository.AddIncidentType(new IncidentTypeDomain()
            {
                TenantId = rule.TenantId,
                Name = rule.Name,
                Code = "1", // all existing types had this code
                IsActive = true
            }));
        }