Exemplo n.º 1
0
        public static void Update(this VacancyEntity entity, Vacancy vacancy)
        {
            entity.TeamId                = vacancy.TeamId.Value;
            entity.JobPositionId         = vacancy.JobPositionId.Value;
            entity.JobsNumber            = vacancy.JobsNumber.Value;
            entity.Salary                = vacancy.Salary;
            entity.CandidateRequirements = vacancy.CandidateRequirements;
            entity.Status                = VacancyStatusEntity.Draft;
            entity.Form.Description      = vacancy.Form.Description;

            entity.Form.Questions.Clear();
            entity.Form.Questions.AddRange(vacancy.Form.Questions.Select(q => q.CreateQuestionEntity()));
        }
Exemplo n.º 2
0
        public async Task <CreateVacancyResult> Handle(CreateVacancy command)
        {
            var vacancyId = Guid.NewGuid();
            var vacancy   = command.Vacancy;

            var entity = new VacancyEntity
            {
                Id   = vacancyId,
                Form = new FormEntity
                {
                    Questions = new List <QuestionEntity>()
                }
            };

            entity.Update(vacancy);
            _vacancyRepository.Add(entity);

            await _unitOfWork.SaveChangesAsync();

            return(new CreateVacancyResult {
                VacancyId = vacancyId
            });
        }
Exemplo n.º 3
0
        public void Add(VacancyEntity vacancy)
        {
            Guard.AgainstNullArgument(nameof(vacancy), vacancy);

            _context.Vacancies.Add(vacancy);
        }