Exemple #1
0
        private async Task <VacancyAlghorythmModel> GetVacancyFromDBAsync(Guid id)
        {
            VacancyAlghorythmModel vacancy = new VacancyAlghorythmModel();

            VacancyServiceModel vacancy2 = await _vacancyService.GetByIdWithSkillAsync(id);

            vacancy.Id            = vacancy2.Id;
            vacancy.Qualification = vacancy2.Qualification.Value;

            foreach (var sr in vacancy2.SkillRequirements)
            {
                vacancy.SkillRequests.Add(new SkillRequestAlghorythmModel()
                {
                    Expirience     = sr.Experience.Value,
                    KnowledgeLevel = sr.KnowledgeLevel
                                     .SkillKnowledgeTypes
                                     .Where(i => i.KnowledgeLevelId == sr.KnowledgeLevelId)
                                     .FirstOrDefault().Value,
                    Weight = (int)sr.Weight,
                    Skill  = new SkillAlghorythmModel()
                    {
                        Id        = sr.SkillId,
                        SkillType = sr.Skill.SkillType.Value,
                        SubSkills = MapSubSkills(sr.Skill)
                    }
                });
            }

            return(vacancy);
        }
Exemple #2
0
        public async Task UpdateAsync(VacancyServiceModel vacancyServiceModel)
        {
            var dto = _mapper.Map <VacancyServiceModel, Vacancy>(vacancyServiceModel);

            _uow.Vacancies.Update(dto);
            await _uow.SaveChangesAsync();
        }
Exemple #3
0
        public async Task <VacancyServiceModel> AddAsync(VacancyServiceModel vacancyServiceModel)
        {
            var vacancyDto = _mapper.Map <VacancyServiceModel, VacancyDTO>(vacancyServiceModel);

            var res = _mapper.Map <VacancyDTO, VacancyServiceModel>(
                await _uow.Vacancies.AddAsync(vacancyDto));
            await _uow.SaveChangesAsync();

            return(res);
        }