Esempio n. 1
0
        public async Task <ValidationResult> Handle(AddProfessionalBackgroundCandidateCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                return(message.ValidationResult);
            }

            var candidate = await _candidateRepository.GetCandidateWithProfessionalBackground(message.CandidateId);

            if (candidate == null)
            {
                AddError("Candidato Invalido");
                return(ValidationResult);
            }

            var professionalBackground = new ProfessionalBackground(message.CandidateId, message.JobTitleLevelId, message.WorkingAreaId, message.JobTitleName, message.StartDate, message.EndDate, message.CurrentJob, message.DescriptionJob, message.Company);

            candidate.AddProfessionalBackground(professionalBackground);
            _candidateRepository.Update(candidate);

            return(await SaveChanges(_candidateRepository.UnitOfWork));
        }
Esempio n. 2
0
 public async Task AddProfessionalBackground(ProfessionalBackground professionalBackground)
 {
     await _context.ProfessionalBackgrounds.AddAsync(professionalBackground);
 }