public ActionResult Index() { using (IProductChannel channel = channelFactory.CreateChannel()) { //return the view of the products inventory return(this.View(from prod in channel.GetProducts() select new Product { Id = prod.Id, Name = prod.Name, Quantity = prod.Quantity })); } }
/// <summary> /// 初始化渠道 /// </summary> /// <param name="code"></param> /// <param name="markType"></param> protected void InitChannel(string code, OrderMarkType markType) { if (markType == OrderMarkType.OrderId) { Channel = AliTripOrderService.GetChannelByOrderId(code); } else { Channel = AliTripOrderService.GetChannelByRPCode(code); } productChannel = ProductChannelFactory.CreateChannel(Channel, Shop); orderRepository = ProductChannelFactory.CreateOrderRepository(Shop, Channel); }
public ActionResult Index(string identifier, string productName) { using (IProductChannel channel = channelFactory.CreateChannel()) { return(View(from prod in channel.getProducts() select new Products { ID = prod.ID.ToString(), Name = prod.Name, Quantity = prod.Quantity } )); } //var products = new List<Products> //{ // new Products {ID=identifier,Name=productName } //}; //return View(products); }