public int AddIncident(POSTIncidentDomain incident, int userTenantId) { if (incident == null) { throw new NsiArgumentException(ExceptionMessages.ArgumentException); } if (!incident.TenantId.Equals(userTenantId)) { throw new NsiArgumentException(IncidentMessages.TenantInvalidId); } //Logic for already solved incidents //Fetch incident settlement data which has same type //as given incident IncidentSettlementDomain incidentSettlement = _incidentWorkOrderRepository.GetIncidentSettlementByTypeId(incident.IncidentType); if (incidentSettlement != null) { //map given incident settlement to current incident IncidentSettlementDomain automatedIncidentSettlement = mapIncidentSettlement(incidentSettlement, incident.TenantId); //save created settlement _incidentSettlementRepository.AddIncidentSettlement(automatedIncidentSettlement); //send notification sendNotification(automatedIncidentSettlement.Description, automatedIncidentSettlement.TenantId); } return(_incidentRepository.AddIncident(incident, userTenantId)); }
public int AddIncidentSettlement(IncidentSettlementDomain incidentSettlement) { if (incidentSettlement == null) { throw new NsiArgumentException(ExceptionMessages.ArgumentException); } return(_incidentSettlementRepository.AddIncidentSettlement(incidentSettlement)); }