// GET: Inventory public ActionResult Index() { productClient pc = new productClient(); ViewBag.listProducts = pc.productList(); return(View()); }
// GET: Inventory/Delete/5 public ActionResult Delete(int id) { try { productClient pc = new productClient(); pc.deleteProduct(id); return(RedirectToAction("Index")); } catch { return(RedirectToAction("Index")); } }
// GET: Inventory/Edit/5 public ActionResult Edit(int id) { Inventory inv = new Inventory(); productClient pc = new productClient(); var res = pc.searchProduct(id); inv.id = res.id; inv.name = res.name; inv.price = res.price; inv.noOfAvailibity = res.noOfAvailibity; inv.availbility = res.availbility; inv.description = res.description; return(View(inv)); }
public ActionResult Edit(Inventory inventory) { try { // TODO: Add update logic here if (ModelState.IsValid) { productClient pc = new productClient(); pc.editProduct(inventory); return(RedirectToAction("Index")); } return(View(inventory)); } catch { return(View(inventory)); } }
public ActionResult Create(Inventory inventory) { try { // TODO: Add insert logic here if (ModelState.IsValid) { productClient pc = new productClient(); pc.createProduct(inventory); return(RedirectToAction("Index")); } return(View(inventory)); } catch { return(View()); } }