Exemplo n.º 1
0
 public ClaimsIdentity CreateCandidateIdentity(CandidateUser user)
 {
     var identity = new ClaimsIdentity(new[] {
             new Claim(ClaimTypes.Name, user.Name),
             new Claim(ClaimTypes.Sid, user.Id),
             new Claim(ClaimTypes.Role, "Candidate"),
             new Claim(ClaimTypes.Email, user.Email)
         }, "ApplicationCookie");
     return identity;
 }
Exemplo n.º 2
0
 public CandidateUser MapToCandidateUser(CandidateUserModel candidateModel)
 {
     var skills = MapSkillModelsToSkills(candidateModel.Skills);
     var candidate = new CandidateUser()
     {
         ExperienceDescription = candidateModel.ExperienceDescription,
         ExperienceInYears = candidateModel.ExperienceInYears,
         Salary = candidateModel.Salary,
         Skills = skills,
     };
     return candidate;
 }
Exemplo n.º 3
0
 private async Task CreateAndInsertCandidateUser(string candidateName, int candidateNumber, Random random)
 {
     var skills = GenerateSkillList(random);
     var candidateUser = new CandidateUser() 
     {
         Name = candidateName + candidateNumber,
         Email = candidateName + candidateNumber + "@" + candidateName + ".pl",
         ModificationDate = DateTime.UtcNow,
         Salary = random.Next(1000, 20000),
         ExperienceInYears = random.Next(1,51),
         Skills = skills,
     };
     SetPassword(candidateUser, "candidate");
     await _databaseService.InsertCaniddateUserAsync(candidateUser);
 }
Exemplo n.º 4
0
        public async Task UpdateCandidateAsync(CandidateUser candidate, string candidateId)
        {
            var filter = Builders<CandidateUser>.Filter.Eq(r => r.Id, candidateId);
            var update = Builders<CandidateUser>
                .Update
                .Set(r => r.ExperienceDescription, candidate.ExperienceDescription)
                .Set(r => r.ExperienceInYears, candidate.ExperienceInYears)
                .Set(r => r.Salary, candidate.Salary)
                .Set(r => r.Skills, candidate.Skills)
                .Set(r => r.ModificationDate, candidate.ModificationDate);

            await dbContext.CandidateUsers.UpdateOneAsync(filter, update);
        }
Exemplo n.º 5
0
 public async Task InsertCaniddateUserAsync(CandidateUser user)
 {
     await dbContext.CandidateUsers.InsertOneAsync(user);
 }
Exemplo n.º 6
0
 public CandidateUserModel MapToCandidateUserModel(CandidateUser candidate)
 {
     var skillModels = MapSkillsToSkillModels(candidate.Skills);
     var candidateModel = new CandidateUserModel(candidate.Salary, candidate.ExperienceDescription, candidate.ExperienceInYears, skillModels);
     return candidateModel;
 }
Exemplo n.º 7
0
 public CandidateUser MapToCandidateUser(string name, string email)
 {
     var user = new CandidateUser
     {
         Name = name,
         Email = email,
     };
     return user;
 }
Exemplo n.º 8
0
 public ScoredCandidateModel MapToScoredCandidateModel(CandidateUser candidate, double score)
 {
     var skillModels = MapSkillsToSkillModels(candidate.Skills);
     var scoredCandidateModel = new ScoredCandidateModel(candidate.Name, candidate.Salary, candidate.ExperienceDescription, candidate.ExperienceInYears, score, skillModels);
     return scoredCandidateModel;
 }
Exemplo n.º 9
0
 public OfferSearchModel MapToOfferSearchModel(CandidateUser candidate)
 {
     var skillModels = MapSkillsToSkillModels(candidate.Skills);
     var offerSearchModel = new OfferSearchModel(skillModels, candidate.Salary);
     return offerSearchModel;
 }
Exemplo n.º 10
0
 public ScoredCandidateViewModel GetScoredCandidateViewModel(double score, CandidateUser candidate)
 {
     var scoredCandidateModel = _mappingService.MapToScoredCandidateModel(candidate, score);
     var scoredCandidateViewModel = _mappingService.MapToScoredCandidateViewModel(scoredCandidateModel, candidate.ModificationDate, candidate.Id);
     return scoredCandidateViewModel;
 }