public async Task <ProductDTO> GetProductDtoFromProductId(Guid productId) { var rq = new GetSingleProductRequest() { ProductId = productId.ToString() }; var catalogGrpcClient = _grpcClientFactory.CreateCatalogGrpcClient(); var response = await catalogGrpcClient.GetProductAsync(rq); var productDto = response.Product; return(productDto); }
public override Task <ReturnSingleProduct> GetProduct(GetSingleProductRequest request, ServerCallContext context) { var product = _productRepository.GetProductById(request.ProductId); if (product == null) { return(Task.FromResult(new ReturnSingleProduct() { Status = GrpcStatus.Error, Product = null })); } var productDto = product.GenerateGrpcProduct(); return(Task.FromResult(new ReturnSingleProduct() { Status = GrpcStatus.Success, Product = productDto })); }