public ProductInfo GetProductById(long productId)
 {
     var msModel = service.GetProductInfoById(productId);
     if (msModel == null) { return null; }
     var localModel = new ProductInfo()
     {
         Picture = msModel.MainPicture,
         ProductId = msModel.MSProductId,
         ProductName = msModel.ProductName,
         ProductPrice = msModel.SellPrice
     };
     return localModel;
 }
Esempio n. 2
0
        public ProductInfo GetProductById(long productId)
        {

            IList<ProductInfo> list = new List<ProductInfo>();
            var model = new ProductInfo()
            {
                ProductId = 1001,
                ProductName = "MacBook Pro",
                Picture = "http://pic.test.com/macpic.jpg",
                ProductPrice = 15000.12m
            };

            list.Add(model);

            return list.Where(product => product.ProductId == productId).FirstOrDefault();

        }