Ejemplo n.º 1
0
        public async Task <ExperienceDto> UpdateExperienceAsync(UpdateExperienceDto input)
        {
            var experience = await _experienceRepo.GetAsync(input.Id);

            ObjectMapper.Map(input, experience);
            var savedExperience = await _experienceRepo.UpdateAsync(experience);

            return(ObjectMapper.Map <ExperienceDto>(savedExperience));
        }
Ejemplo n.º 2
0
        public async Task <Dto> UpdateExperience <Dto>(ulong primaryKey, ulong experienceId, UpdateExperienceDto updateExperienceDto)
        {
            Candidate candidate = null;

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

            Experience experience = candidate.Experience.SingleOrDefault(experience => experience.Id == experienceId);

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

            _mapper.Map(updateExperienceDto, experience);
            candidate = await _repository.Update(candidate);

            Dto mappedExperience = _mapper.Map <Dto>(experience);

            return(mappedExperience);
        }
Ejemplo n.º 3
0
 public async Task <ExperienceDto> Update(UpdateExperienceDto input)
 {
     return(await _experienceAppService.UpdateExperienceAsync(input));
 }