public async Task <GoodsApiDTO> Handle( [NotNull] GetGoodsByIdQuery request, CancellationToken cancellationToken) { Guard.NotNull(request, nameof(request)); var goodsItem = await _goodsRepository.GetByIdAsync( request.Id, cancellationToken).ConfigureAwait(false); return(_mapper.Map <GoodsApiDTO>(goodsItem)); }
protected override async Task Handle( [NotNull] DeleteGoodsItemByIdCommand request, CancellationToken cancellationToken) { Guard.NotNull(request, nameof(request)); var goodsItem = await _goodsRepository .GetByIdAsync(request.Id, cancellationToken) .ConfigureAwait(false); if (goodsItem != null) { await _goodsRepository .DeleteAsync(goodsItem, cancellationToken) .ConfigureAwait(false); } }