public ActionResult Index() { //List<Product> list = new List<Product>(); //list.Add(new Product("Apple", "Golden", 5)); //list.Add(new Product("Apple","Green",10)); //list.Add(new Product("Apple", "Green", 10)); ProductModel model = new ProductModel(); model.products = context.Products.AsEnumerable().ToList(); return View(model); }
/// <summary> /// Deprecated Method for adding a new object to the ProductModels EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProductModels(ProductModel productModel) { base.AddObject("ProductModels", productModel); }
/// <summary> /// Create a new ProductModel object. /// </summary> /// <param name="productModelID">Initial value of the ProductModelID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="rowguid">Initial value of the rowguid property.</param> /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param> public static ProductModel CreateProductModel(global::System.Int32 productModelID, global::System.String name, global::System.Guid rowguid, global::System.DateTime modifiedDate) { ProductModel productModel = new ProductModel(); productModel.ProductModelID = productModelID; productModel.Name = name; productModel.rowguid = rowguid; productModel.ModifiedDate = modifiedDate; return productModel; }