Esempio n. 1
0
 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<ActionResult> Index(CandidateSearchModel model)
 {
     if (ValidateForm(model))
     {
         var newCandidateSearchViewModel = await _applicationService.GetCandidatesSearchViewModelAsync(model);
         if (!newCandidateSearchViewModel.HasCandidates())
         {
             AddNoCandidatesError();
         }
         return View(newCandidateSearchViewModel);
     }
     var offerSearchViewModelWithoutOffers = _applicationService.GetCandidatesSearchViewModelWithoutCandidates(model);
     return View(offerSearchViewModelWithoutOffers);
 }
 private bool ValidateForm(CandidateSearchModel model)
 {
     if (_applicationService.AreSkillsDuplicated(model.Skills))
     {
         ModelState.AddModelError("duplicateSkills", "You can't have repeated skills");
     }
     if (_applicationService.IsMinSalaryOverMaxSalary(model.MinSalary, model.MaxSalary))
     {
         ModelState.AddModelError("minOverMaxSalary", "Max salary must be grater or equal than min salary");
     }
     if (_applicationService.IsMinExperienceOverMaxExperience(model.MinExperienceInYears, model.MaxExperienceInYears))
     {
         ModelState.AddModelError("minOverMaxExperience", "Max experience must be greater or equal than min experience");
     }
     return ModelState.IsValid;
 }
 public CandidateSearchViewModel(CandidateSearchModel searchParams, ScoredCandidatesListViewModel candidates)
 {
     SearchParams = searchParams;
     Candidates = candidates;
 }
 public CandidateSearchViewModel()
 {
     SearchParams = new CandidateSearchModel();
     Candidates = new ScoredCandidatesListViewModel();
 }
Esempio n. 6
0
 public CandidateSearchViewModel MapToCandidateSearchViewModel(CandidateSearchModel searchModel, ScoredCandidatesListViewModel candidatesListViewModel)
 {
     return new CandidateSearchViewModel(searchModel, candidatesListViewModel);
 }
Esempio n. 7
0
 public CandidateSearchViewModel GetCandidatesSearchViewModelWithoutCandidates(CandidateSearchModel searchModel)
 {
     var scoredCandidatesListViewModel = new ScoredCandidatesListViewModel();
     var candidateSearchViewModel = _mappingService.MapToCandidateSearchViewModel(searchModel, scoredCandidatesListViewModel);
     return candidateSearchViewModel;
 }
Esempio n. 8
0
 private async Task<ScoredCandidatesListViewModel> GetScoredCandidatesListViewModelAsync(CandidateSearchModel searchModel)
 {
     var skills = _mappingService.MapSkillModelsToSkills(searchModel.Skills);
     var candidatesList = await _dbService.GetCandidatesListBySearchModelAsync(searchModel.MinSalary, searchModel.MaxSalary, searchModel.MinExperienceInYears, searchModel.MaxExperienceInYears, searchModel.SortBy, skills);
     var candidateViewModelsList = GetScoredCandidateViewModelList(skills, candidatesList);
     var sortedCandidateViewModelsList = SortByScoreIfNeeded(candidateViewModelsList, searchModel.SortBy);
     var candidatesListViewModel = _mappingService.MapToScoredCandidatesListViewModel(sortedCandidateViewModelsList);
     return candidatesListViewModel;
 }
Esempio n. 9
0
 public async Task<CandidateSearchViewModel> GetCandidatesSearchViewModelAsync(CandidateSearchModel searchModel)
 {
     var candidatesListViewModel = await GetScoredCandidatesListViewModelAsync(searchModel);
     var candidateSearchViewModel = _mappingService.MapToCandidateSearchViewModel(searchModel, candidatesListViewModel);
     return candidateSearchViewModel;
 }