public async Task <Unit> Handle(DeleteValueOptionTranslationCommand request, CancellationToken cancellationToken)
            {
                var valueOptionTranslation = await _valueOptionTranslationRepository.GetValueOptionTranslation(request.Id);

                if (valueOptionTranslation == null)
                {
                    throw new NotFoundException(nameof(DeleteValueOptionTranslationCommand), request.Id);
                }

                _valueOptionTranslationRepository.RemoveValueOptionTranslation(valueOptionTranslation);
                await _unitOfWork.CompleteAsync(cancellationToken);

                return(Unit.Value);
            }
Пример #2
0
            public async Task <Unit> Handle(UpdateValueOptionTranslationCommand request, CancellationToken cancellationToken)
            {
                var valueOptionTranslation = await _translationRepository.GetValueOptionTranslation(request.Id);

                if (valueOptionTranslation == null)
                {
                    throw new NotFoundException(nameof(UpdateValueOptionTranslationCommand), request.Id);
                }

                valueOptionTranslation.ValueOptionId = request.ValueOptionId;
                valueOptionTranslation.Description   = request.Description;
                valueOptionTranslation.Language      = request.Language;
                valueOptionTranslation.Name          = request.Name;

                await _unitOfWork.CompleteAsync();

                return(Unit.Value);
            }