Example #1
0
        private static GetProductResponse GetProduct(ProductService.ProductServiceClient client, string id)
        {
            try
            {
                var response = client.GetProduct(new GetProductRequest()
                {
                    ProductId = id
                });

                Console.WriteLine(response.Product.ToString());

                return(response);
            }
            catch (RpcException e)
            {
                Console.WriteLine(e.Status.Detail);
                //just log and continue;
                Console.ReadKey();
                return(null);
            }
        }
Example #2
0
        public JsonResult GetProduct(int id)
        {
            var product = client.GetProduct(id);

            return(Json(product, JsonRequestBehavior.AllowGet));
        }