public ActionResult GetAllProductDetails() { PrdRepository PrdRepo = new PrdRepository(); ModelState.Clear(); return(View(PrdRepo.GetAllProducts())); }
public ActionResult EditProductDetails(int id, ProductModel obj) { try { PrdRepository PrdRepo = new PrdRepository(); PrdRepo.UpdateProduct(obj); return(RedirectToAction("GetAllProductDetails")); } catch { return(View()); } }
// GET: Product/Delete/5 public ActionResult DeleteProduct(int id) { try { PrdRepository PrdRepo = new PrdRepository(); if (PrdRepo.DeleteProduct(id)) { ViewBag.AlertMsg = "Product details deleted successfully"; } return(RedirectToAction("GetAllProductDetails")); } catch { return(View()); } }
public ActionResult AddProduct(ProductModel Prd) { try { if (ModelState.IsValid) { PrdRepository PrdRepo = new PrdRepository(); if (PrdRepo.AddProduct(Prd)) { ViewBag.Message = "Product details added successfully"; } } return(View()); } catch { return(View()); } }
// GET: Product/Edit/5 public ActionResult EditProductDetails(int id) { PrdRepository PrdRepo = new PrdRepository(); return(View(PrdRepo.GetAllProducts().Find(ProductModel => ProductModel.Prdid == id))); }