public int AddIncidentType(IncidentTypeDomain incidentType) { var incidentTypeDb = new IncidentType().FromDomainModel(incidentType); _context.IncidentType.Add(incidentTypeDb); _context.SaveChanges(); return(incidentTypeDb.IncidentTypeId); }
public void UpdateIncidentType(IncidentTypeDomain incidentType) { if (incidentType == null) { throw new NsiArgumentException(ExceptionMessages.ArgumentException); } _incidentTypeRepository.UpdateIncidentType(incidentType); }
public int AddIncidentType(IncidentTypeDomain incidentType) { if (incidentType == null) { throw new NsiArgumentException(ExceptionMessages.ArgumentException); } return(_incidentTypeRepository.AddIncidentType(incidentType)); }
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); }
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(); }
/// <summary> /// Edit incident Type /// </summary> /// <returns><see cref="int"/></returns> public void EditIncidentType(IncidentTypeDomain incidentType) { _incidentTypeManipulation.UpdateIncidentType(incidentType); }
/// <summary> /// Add new incident Type /// </summary> /// <returns><see cref="int"/></returns> public int AddIncidentType(IncidentTypeDomain incidentType) { return(_incidentTypeManipulation.AddIncidentType(incidentType)); }