public ActionResult Order(Customer customer, int Id = 1) { ProductStorage storage = new ProductStorage(); if (!storage.ProductList.ContainsKey(Id)) { return HttpNotFound(); } if (ModelState.IsValid) { Order order = new Order() { Customer = customer, Date = DateTime.Now, Product = storage.ProductList[Id] }; OrderSender.SendNotifications(order); return View("Done"); } ViewBag.SelectedProduct = storage.ProductList[Id]; return View("Index"); }
public ActionResult Index(int id = 1) { ProductStorage storage = new ProductStorage(); if (!storage.ProductList.ContainsKey(id)) return HttpNotFound(); ViewBag.SelectedProduct = storage.ProductList[id]; return View(); }
// GET: Home public ActionResult Index() { ProductStorage storage = new ProductStorage(); return View(storage.ProductList.Values.ToList()); }