Exemple #1
0
        public async Task <EducationDto> UpdateEducationAsync(UpdateEducationDto input)
        {
            var education = await _educationRepo.GetAsync(input.Id);

            ObjectMapper.Map(input, education);
            var savedEducation = await _educationRepo.UpdateAsync(education);

            return(ObjectMapper.Map <EducationDto>(savedEducation));
        }
Exemple #2
0
        public async Task <Dto> UpdateEducation <Dto>(ulong primaryKey, ulong educationId, UpdateEducationDto updateEducationDto)
        {
            Candidate candidate = null;

            try
            {
                candidate = _repository.GetAll().Where(candidate => candidate.Id == primaryKey).Include(candidate => candidate.Education).Single();
            }
            finally
            {
                if (candidate == null)
                {
                    throw new Exception($"A candidate with id \"{primaryKey}\" was not found.");
                }
            }

            Education education = candidate.Education.SingleOrDefault(education => education.Id == educationId);

            if (education == null)
            {
                throw new Exception($"An education with id \"{educationId}\" was not found.");
            }

            _mapper.Map(updateEducationDto, education);
            education.Level = education.Level.ToUpper();
            candidate       = await _repository.Update(candidate);

            Dto mappedEducation = _mapper.Map <Dto>(education);

            return(mappedEducation);
        }
Exemple #3
0
 public async Task <EducationDto> Update(UpdateEducationDto input)
 {
     return(await _educationAppService.UpdateEducationAsync(input));
 }