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