예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        GetProductsClient client = new GetProductsClient();
        DS.DataContracts.Requests.ProductRequest request = new DS.DataContracts.Requests.ProductRequest();
        request.ProductIDs = new List<int>();
        request.DisplayAll = true;
        DS.DataContracts.Responses.ProductResponse response = client.GetProducts(request);
        gvProducts.DataSource = BuildProductDataTable(response.Products);
        gvProducts.DataBind();

        PreformCartAction();
    }
예제 #2
0
        public ProductResponse GetProducts(ProductRequest request)
        {
            ProductResponse resp = new ProductResponse();

            IEnumerable<Entities.Product> products = Product.ProductInfo.GetProductInfo();
            if (!request.DisplayAll) products = products.Where(i => request.ProductIDs.Contains(i.ProductID));
            foreach (Entities.Product p in products)
            {
                DataContracts.Product dc = ProductTransformer.Transform(p);
                dc.Images = Product.Images.GetImages(p.ProductID).Select(i => ProductImageTransformer.Transform(i)).ToList();
                resp.Products.Add(dc);
            }
            return resp;
        }