Exemplo n.º 1
0
        void IJobAdsCommand.DeleteJobAd(JobAdEntry jobAd)
        {
            if (jobAd.Status == JobAdStatus.Deleted)
            {
                return;
            }
            if (!CanBeDeleted(jobAd))
            {
                throw new InvalidOperationException(string.Format("Cannot delete the '{0}' job ad.", jobAd.Id));
            }

            _repository.DeleteRefresh(jobAd.Id);
            _repository.ChangeStatus(jobAd.Id, JobAdStatus.Deleted, null, DateTime.Now);
            jobAd.Status = JobAdStatus.Deleted;
        }