public ActionResult Create() { var catalogManager = new CatalogManager(); ViewBag.AllCatalogs = catalogManager.GetAllCatalogs(); return(View()); }
public ActionResult Edit([Bind(Include = "Id,Code,Description, CatalogId")] Product product) { if (!ModelState.IsValid) { var catalogManager = new CatalogManager(); ViewBag.AllCatalogs = catalogManager.GetAllCatalogs(); return(View(product)); } var productManager = new ProductManager(); productManager.SaveModifed(product); return(RedirectToAction("Index")); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var catalogManager = new CatalogManager(); ViewBag.AllCatalogs = catalogManager.GetAllCatalogs(); var productManager = new ProductManager(); Product product = productManager.GetProductById(id); if (product == null) { return(HttpNotFound()); } return(View(product)); }
public ActionResult Index() { var catalogManager = new CatalogManager(); return(View(catalogManager.GetAllCatalogs())); }