示例#1
0
        public IQueryable<Product> Load()
        {
            IList<Product> products = new List<Product>();
            Product product;
            ProductPhoto prodPhoto;
            ProductProductPhoto prodProdPhoto;

            product = new Product();
            product.Name = "Road-150 Red, 48";
            prodPhoto = new ProductPhoto();
            prodPhoto.PhotoPath = "~/Content/Images/SampleCycles/cycle1.gif";
            prodProdPhoto = new ProductProductPhoto() { ProductPhoto = prodPhoto };
            product.ProductProductPhotoes.Add(prodProdPhoto);
            products.Add(product);

            product = new Product();
            product.Name = "Touring-2000 Blue, 60";
            prodPhoto = new ProductPhoto();
            prodPhoto.PhotoPath = "~/Content/Images/SampleCycles/cycle2.gif";
            prodProdPhoto = new ProductProductPhoto() { ProductPhoto = prodPhoto };
            product.ProductProductPhotoes.Add(prodProdPhoto);
            products.Add(product);

            product = new Product();
            product.Name = "Mountain-100 Black, 42";
            prodPhoto = new ProductPhoto();
            prodPhoto.PhotoPath = "~/Content/Images/SampleCycles/cycle3.gif";
            prodProdPhoto = new ProductProductPhoto() { ProductPhoto = prodPhoto };
            product.ProductProductPhotoes.Add(prodProdPhoto);
            products.Add(product);

            product = new Product();
            product.Name = "Road-350-W Yellow, 44";
            prodPhoto = new ProductPhoto();
            prodPhoto.PhotoPath = "~/Content/Images/SampleCycles/cycle4.jpg";
            prodProdPhoto = new ProductProductPhoto() { ProductPhoto = prodPhoto };
            product.ProductProductPhotoes.Add(prodProdPhoto);
            products.Add(product);

            return products.AsQueryable<Product>();
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the ProductPhotoes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProductPhotoes(ProductPhoto productPhoto)
 {
     base.AddObject("ProductPhotoes", productPhoto);
 }
 /// <summary>
 /// Create a new ProductPhoto object.
 /// </summary>
 /// <param name="productPhotoID">Initial value of the ProductPhotoID property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static ProductPhoto CreateProductPhoto(global::System.Int32 productPhotoID, global::System.DateTime modifiedDate)
 {
     ProductPhoto productPhoto = new ProductPhoto();
     productPhoto.ProductPhotoID = productPhotoID;
     productPhoto.ModifiedDate = modifiedDate;
     return productPhoto;
 }