Exemple #1
0
        public int AddIncidentType(IncidentTypeDomain incidentType)
        {
            var incidentTypeDb = new IncidentType().FromDomainModel(incidentType);

            _context.IncidentType.Add(incidentTypeDb);
            _context.SaveChanges();
            return(incidentTypeDb.IncidentTypeId);
        }
Exemple #2
0
        public void UpdateIncidentType(IncidentTypeDomain incidentType)
        {
            if (incidentType == null)
            {
                throw new NsiArgumentException(ExceptionMessages.ArgumentException);
            }

            _incidentTypeRepository.UpdateIncidentType(incidentType);
        }
Exemple #3
0
        public int AddIncidentType(IncidentTypeDomain incidentType)
        {
            if (incidentType == null)
            {
                throw new NsiArgumentException(ExceptionMessages.ArgumentException);
            }

            return(_incidentTypeRepository.AddIncidentType(incidentType));
        }
Exemple #4
0
        public static IncidentType FromDomainModel(this IncidentType obj, IncidentTypeDomain domain)
        {
            if (obj == null)
            {
                obj = new IncidentType();
            }

            obj.IncidentTypeId = domain.IncidentTypeId;
            obj.Name           = domain.Name;
            obj.Code           = domain.Code;
            obj.IsActive       = domain.IsActive;

            return(obj);
        }
Exemple #5
0
        public void UpdateIncidentType(IncidentTypeDomain incidentType)
        {
            if (incidentType == null)
            {
                throw new NsiArgumentNullException(ExceptionMessages.ArgumentException);
            }

            var incidentTypeDb = _context.IncidentType.FirstOrDefault(x => x.IncidentTypeId == incidentType.IncidentTypeId);

            if (incidentTypeDb == null)
            {
                throw new NsiArgumentNullException(IncidentMessages.IncidentTypeInvalidId);
            }

            incidentTypeDb.FromDomainModel(incidentType);
            _context.SaveChanges();
        }
Exemple #6
0
 /// <summary>
 /// Edit incident Type
 /// </summary>
 /// <returns><see cref="int"/></returns>
 public void EditIncidentType(IncidentTypeDomain incidentType)
 {
     _incidentTypeManipulation.UpdateIncidentType(incidentType);
 }
Exemple #7
0
 /// <summary>
 /// Add new incident Type
 /// </summary>
 /// <returns><see cref="int"/></returns>
 public int AddIncidentType(IncidentTypeDomain incidentType)
 {
     return(_incidentTypeManipulation.AddIncidentType(incidentType));
 }