Esempio n. 1
0
        public async Task <bool> Handle(RemoveVacancies request, CancellationToken cancellationToken)
        {
            try
            {
                var response = await _repository.RemoveById(request.Id);

                await _repository.SaveAsync(cancellationToken);

                return(response);
            }
            catch (Exception e)
            {
                _logger.LogError(nameof(RemoveVacanciesHandler.Handle), e);
                return(false);
            }
        }
Esempio n. 2
0
        public async Task <bool> Handle(CreateVacancies request, CancellationToken cancellationToken)
        {
            try
            {
                var result   = _mapper.Map <Vacancies>(request.CreateVacanciesDto);
                var response = await _repository.CreateAsync(result);

                await _repository.SaveAsync(cancellationToken);

                return(response);
            }
            catch (Exception e)
            {
                _logger.LogError(nameof(CreateVacanciesHandler.Handle), e);
                return(false);
            }
        }