예제 #1
0
 //
 // GET: /Product/Create
 public ActionResult Create(int id)
 {
     CategoryRepo cr = new CategoryRepo();
     if (cr.ValidateID(id))
     {
         ProductModel p = new ProductModel();
         p.Category = id;
         return View(p);
     }
     return RedirectToAction("Index", "Category");
 }
예제 #2
0
 //
 // GET: /Product/
 public ActionResult Index(int? id)
 {
     if (id == null)
         return null;
     CategoryRepo cr = new CategoryRepo();
     if(cr.ValidateID(id.Value))
     {
         ViewData["category"] = id;
         return View(products.GetProductsFromCategory(id.Value));
     }
     return RedirectToAction("Index", "Category");
 }