コード例 #1
0
        public ContractJobOffer CreateJobOffer(CreateContractJobOfferParams parameters)
        {
            var jobOffer = CreateJobOffer(parameters as CreateJobOfferParams);

            var contract = new ContractJobOffer()
            {
                Length    = parameters.Length,
                MinHP     = parameters.MinimumHP,
                MinSalary = (decimal)parameters.MinimumSalary,
                SigneeID  = parameters.SigneeID
            };

            jobOffer.ContractJobOffer = contract;

            if (parameters.Cost > 0 && parameters.CountryID.HasValue)
            {
                var country = countryRepository.GetById(parameters.CountryID.Value);
                var company = companyRepository.GetById(parameters.CompanyID);

                PayJobOfferFee(company, country, JobOfferTypeEnum.Contract, parameters.Amount, parameters.CurrencyID, parameters.Cost);
            }

            jobOfferRepository.Add(jobOffer);
            jobOfferRepository.SaveChanges();

            return(jobOffer.ContractJobOffer);
        }
コード例 #2
0
        public JobOfferDTO AddJobOffer(JobOfferForManipulationDTO jobOffer)
        {
            var jobOfferToAdd = _mapper.Map <JobOffer>(jobOffer);

            jobOfferToAdd.DateOfAdding = DateTime.Now;

            _jobOfferRepository.Add(jobOfferToAdd);
            if (!_jobOfferRepository.Save())
            {
                throw new Exception("Adding Job Offer has been failed!");
            }

            return(_mapper.Map <JobOfferDTO>(jobOfferToAdd));
        }
コード例 #3
0
        public async Task <JobOfferViewModel> Add(JobOfferViewModel jobOfferViewModel)
        {
            var jobOffer = _mapper.Map <JobOffer>(jobOfferViewModel);

            jobOffer.Id = Guid.NewGuid();

            if (!ExecuteValidation(new JobOfferValidation(), jobOffer))
            {
                return(null);
            }

            if (_jobOfferRepository.Get(j => j.ContractCode == jobOffer.ContractCode).Result.Any())
            {
                Notify("There is already a jobber offer with the contract code informed.");
                return(null);
            }

            if (!_companyrepository.Get(j => j.Id == jobOffer.CompanyId).Result.Any())
            {
                Notify("The company does not exists.");
                return(null);
            }

            await _jobOfferRepository.Add(jobOffer);

            return(_mapper.Map <JobOfferViewModel>(jobOffer));
        }
コード例 #4
0
        public async Task <bool> Add(JobOffer item)
        {
            item.Submitted = DateTime.Now;
            item.LastEdit  = DateTime.Now;

            _jobOfferRepo.Add(item);
            await _unitOfWork.Save();

            return(true);
        }
コード例 #5
0
        public void Add(CreateOfferViewModel model, string companyId)
        {
            JobOffer offer = new JobOffer();

            offer.Title            = model.Title;
            offer.Description      = model.Description;
            offer.DateCreated      = DateTime.Now;
            offer.TownId           = model.TownId;
            offer.IsActive         = true;
            offer.CompanyId        = companyId;
            offer.BusinessSectorId = model.BusinessSectorId;
            offer.IsPermanent      = model.IsPermanent;
            offer.IsFullTime       = model.IsFullTime;
            _jobOfferRepository.Add(offer);
            _jobOfferRepository.SaveChanges();
        }