コード例 #1
0
        public void Advertise(Job job)
        {
            try
            {
                var properties = _propertyService.GetAvailablePropertiesIncludingDetailsAndPhotos();

                var results = _autoAdvertiseProviderFactory
                    .GetAll()
                    .Where(x => x.SupportsAdvertiseAll())
                    .Select(provider => provider.AdvertiseAllProperties(job.JobReference, properties))
                    .ToList();

                _autoAdvertiseResultRepository.CreateAdvertiseResults(AdvertiseResultFactory.Build(results,
                    properties.Select(x => x.PropertyReference).ToList(),
                    _referenceGenerator));

                _autoAdvertiseResultRepository.UpdateJob(job.JobReference, job.MarkAsSuccess());
            }
            catch (Exception)
            {
                _autoAdvertiseResultRepository.UpdateJob(job.JobReference, job.MarkAsFailure());
            }
        }