public CandidateSearchModel MapToCandidateSearchModel(JobOffer offer)
 {
     if (offer != null)
     {
         var skills = MapSkillsToSkillModels(offer.Skills);
         var candidateSearchModel = new CandidateSearchModel(skills, offer.Salary);
         return candidateSearchModel;
     }
     else
     {
         return new CandidateSearchModel();
     }
 }
        public async Task UpdateJobOfferAsync(JobOffer offer, string offerId)
        {
            var filter = Builders<JobOffer>.Filter.Eq(r => r.Id, offerId);
            var update = Builders<JobOffer>
                .Update
                .Set(r => r.Name, offer.Name)
                .Set(r => r.Salary, offer.Salary)
                .Set(r => r.Skills, offer.Skills)
                .Set(r => r.Description, offer.Description)
                .Set(r => r.ModificationDate, offer.ModificationDate);

            await dbContext.JobOffers.UpdateOneAsync(filter, update);
        }
 public async Task InsertJobOfferAsync(JobOffer offer)
 {
     await dbContext.JobOffers.InsertOneAsync(offer);
 }
        public async Task CanGetJobOfferById()
        {
            JobOffer jobOffer = new JobOffer()
            {
                Name = "AA",
                Salary = 11,
                RecruiterId = "22222",
                Description = "Description",
                Skills = new List<Skill>() { new Skill() { Name = "C++", Level = 5 } }
            };

            dbService
                .Setup(r => r.GetJobOfferByIdAsync(It.IsAny<string>()))
                .Returns(Task<JobOffer>.FromResult(jobOffer));

            var result = await applicationService.GetJobOfferByIdAsync("11111");

            Assert.AreEqual(jobOffer.Name, result.Name);
        }
 public ScoredOfferModel MapToScoredOfferModel(JobOffer offer, double score)
 {
     var skills = MapSkillsToSkillModels(offer.Skills);
     var scoredOfferModel = new ScoredOfferModel(offer.Id, offer.Name, offer.Salary, score, offer.Description, skills);
     return scoredOfferModel;
 }
 public OfferModel MapToOfferModel(JobOffer offer)
 {
     var skills = MapSkillsToSkillModels(offer.Skills);
     var offerModel = new OfferModel(offer.Id, offer.Name, offer.Salary, offer.Description, skills);
     return offerModel;
 }
 public JobOffer MapToJobOffer(OfferModel model, string id)
 {
     var skills = MapSkillModelsToSkills(model.Skills);
     var offer = new JobOffer(model.Name, model.Salary, id, model.Description, skills);
     return offer;
 }
 public ScoredOfferViewModel GetScoredOfferViewModel(double score, JobOffer offer)
 {
     var scoredOfferModel = _mappingService.MapToScoredOfferModel(offer, score);
     var scoredOfferViewModel = _mappingService.MapToScoredOfferViewModel(scoredOfferModel, offer.ModificationDate);
     return scoredOfferViewModel;
 }
 private void GenerateOffersForRecruiter(int numberOfOffersForRecruiter, string recruiterName, int recuiterNumber, string recruiterId, Random random)
 {
     for (int j = 0; j < numberOfOffersForRecruiter; j++)
     {
         var skillList = GenerateSkillList(random);
         var offer = new JobOffer()
         {
             RecruiterId = recruiterId,
             ModificationDate = DateTime.UtcNow,
             Name = "Recruiter " + recruiterName + recuiterNumber + ": Offer " + j,
             Salary = random.Next(1000, 20000),
             Skills = skillList,
         };
         _databaseService.InsertJobOfferAsync(offer);
     }
 }