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); }
public ActionResult <JobOfferDTO> CreateJobOffer(JobOfferCreateDTO jobOfferCreateDto) { var jobOfferModel = _mapper.Map <JobOffer>(jobOfferCreateDto); _jobOfferRepository.CreateJobOffer(jobOfferModel); _jobOfferRepository.SaveChanges(); var jobOfferDto = _mapper.Map <JobOfferDTO>(jobOfferModel); //return Ok(JobOfferDTO); return(CreatedAtRoute(nameof(GetJobOfferById), new { Id = jobOfferDto.JobId }, jobOfferDto)); }
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(); }
public virtual void RemoveJobOffersThatDoesNotMeetMinimalWage(decimal minimalWage, int countryID) { var offers = jobOfferRepository.GetJobOffersWithoutMinimalWage(minimalWage, countryID); var offersByCompanies = offers.GroupBy(o => o.CompanyID); using (NoSaveChanges) { foreach (var offer in offersByCompanies) { InformCompanyAboutOfferRemovedDueToMinimalWage(offer.First(), offer.Count()); } foreach (var offer in offers) { jobOfferRepository.Remove(offer); } } jobOfferRepository.SaveChanges(); }