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;
 }
示例#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;
 }
示例#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);
 }
示例#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);
        }
示例#5
0
 public async Task InsertCaniddateUserAsync(CandidateUser user)
 {
     await dbContext.CandidateUsers.InsertOneAsync(user);
 }
示例#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;
 }
示例#7
0
 public CandidateUser MapToCandidateUser(string name, string email)
 {
     var user = new CandidateUser
     {
         Name = name,
         Email = email,
     };
     return user;
 }
示例#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;
 }
示例#9
0
 public OfferSearchModel MapToOfferSearchModel(CandidateUser candidate)
 {
     var skillModels = MapSkillsToSkillModels(candidate.Skills);
     var offerSearchModel = new OfferSearchModel(skillModels, candidate.Salary);
     return offerSearchModel;
 }
示例#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;
 }