Example #1
0
 public MapperData MapFromMessage(IMessage message)
 {
     return(new MapperData
     {
         EmployerIds = _empIdMapper.MapEmpIdsFromMessage(message),
         EpaOrgIds = _epaOrgIdMapper.MapEpaOrgIdsFromMessage(message),
         FM36Ulns = _fM36UlnMapper.MapFM36UlnsFromMessage(message),
         LARSLearningDeliveryKeys = _learnAimRefMapper.MapLARSLearningDeliveryKeysFromMessage(message),
         LearningProviderUKPRN = _learningProviderUkprnMapper.MapLearningProviderUKPRNFromMessage(message),
         Postcodes = _postcodesMapper.MapPostcodesFromMessage(message),
         StandardCodes = _standardCodesMapper.MapStandardCodesFromMessage(message),
         UKPRNs = _ukprnsMapper.MapUKPRNsFromMessage(message),
         ULNs = _ulnMapper.MapUlnsFromMessage(message),
     });
 }
        public async Task <List <int> > ValidateErnsAsync(IMessage message, CancellationToken cancellationToken)
        {
            var erns = _empIdMapper.MapEmpIdsFromMessage(message);

            var validErns = new List <int>();

            var stopwatch = new Stopwatch();

            try
            {
                stopwatch.Start();
                var invalidErns = new HashSet <int>(await _edrsClientService.GetInvalidErns(erns, cancellationToken));
                validErns = erns.Except(invalidErns).ToList();
                stopwatch.Stop();
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message, ex);
            }

            _logger.LogInfo("EDRS API call took: " + stopwatch.Elapsed.TotalSeconds + " secs");

            return(validErns);
        }