public ActionResult DemoArray() { Product[] array = new Product[] { new Product() {Name = "Kayak", Price = 275M}, new Product() {Name = "Lifejacket", Price = 48.95M}, new Product() {Name = "Soccer ball", Price = 19.50M}, new Product() {Name = "Corner flag", Price = 34.95M} }; return View(array); }
public HomeController() { product = new Product { ProductId = 1, Name = "Kayak", Category = "Watersports", Description = "A boat for one person", Price = 275M, }; }
// // GET: /Product/ public ActionResult Index() { Product myProduct = new Product { ProductID = 1, Name = "Kayak", Description = "A boat for one person", Price = 275M, Category = "Watersports" }; ViewBag.Item = "hello"; return View(myProduct); }
public ActionResult Index() { Product product = new Product { ProductID = 1, Name = "Kayak", Description = "A boat for one person", Category = "Watersports", Price = 275m, }; ViewBag.ProcessingTime = DateTime.Now.ToLongTimeString(); return View(product); }