Exemplo n.º 1
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
            }));
        }
Exemplo n.º 2
0
 public ICollection <IncidentTypeDomain> GetAllIncidentTypes()
 {
     return(_incidentTypeRepository.GetAllIncidentTypes());
 }