public async Task <JobOfferPropositionDetailViewModel> Handle(GetJobOfferPropositionDetailQuery request, CancellationToken cancellationToken) { var entities = await _jobOfferPropositionRepository.GetByIdAsync(request.Id); if (entities == null) { _logger.LogWarning("Entity not found from database. Request ID: {0}", request.Id); throw new NotFoundException(nameof(JobOfferProposition), request.Id); } return(_mapper.Map <JobOfferPropositionDetailViewModel>(entities)); }
public async Task <Unit> Handle(DeleteJobOfferPropositionCommand request, CancellationToken cancellationToken) { var entity = await _jobOfferPropositionRepository.GetByIdAsync(request.Id); if (entity == null) { _logger.LogWarning("Entity not found from database. Request ID: {0}", request.Id); throw new NotFoundException(nameof(JobOfferProposition), request.Id); } await _jobOfferPropositionRepository.DeleteAsync(entity); _logger.LogInformation("Deleted JobOfferProposition Id: {0}", request.Id); return(Unit.Value); }