public ActionResult SaveCandidateScore(CandidateScore score) { var result = new ResultModel(); if (score != null) { score.RatedBy = SessionItems.CurrentUser.UserID; result = score.Insert(); } return(new JsonResult() { Data = result }); }
/// <summary> /// Handle a new candidate /// Keeps a reference to the crawl and score, if the page is already present in the store then update score to the maximum of both /// </summary> /// <param name="score">The score of the candidate</param> /// <param name="candiate">The candidate</param> public void HandleCandidate(double score, PageCrawl candiate) { // Update existing IEnumerable <CandidateScore> matchingCandidates = candidates.Where(x => x.Candidate.Page.ToString() == candiate.Page.ToString()); if (matchingCandidates.Count() > 0) { CandidateScore existing = matchingCandidates.First(); existing.Score = Math.Max(existing.Score, score); Console.WriteLine("Existing candidate: " + candiate.Page + " - score updated to " + existing.Score); return; } // Add new Console.WriteLine("New candidate: " + candiate.Page + " - " + score); candidates.Add(new CandidateScore(score, candiate)); }
/// <summary> /// Metodo responsavel por adicionar o candidato a lista de ranking com o score do candidato para a vaga /// </summary> /// <param name="vaga">Dados da vaga</param> /// <param name="pessoa">Dados do candidato</param> /// <returns>Status de registro da ranking do candidato a vaga</returns> public async Task <bool> AddRankingVaga(Vaga vaga, Pessoa pessoa) { Ranking model = new Ranking(); CandidateScore calculate = new CandidateScore(); JobLevelParser parser = new JobLevelParser(); Enum.TryParse(pessoa.Localizacao, out Location candidateLocation); Enum.TryParse(vaga.Localizacao, out Location jobLocation); ExperienceLevel candidateLevel = parser.Parse(pessoa.Nivel); ExperienceLevel jobLevel = parser.Parse(vaga.Nivel); int score = calculate.CalculateCandidateScore(candidateLocation, candidateLevel, jobLocation, jobLevel); model.IdVaga = vaga.ID; model.Localizacao = pessoa.Localizacao; model.Nivel = pessoa.Nivel; model.Nome = pessoa.Nome; model.Profissao = pessoa.Profissao; model.Score = score; return(await _repository.AddRankingVaga(model)); }