public ActionResult DeleteConfirmed(int id) { Productc productc = _productService.FindById(id); _productService.DeleteProduct(productc); return(RedirectToAction("Index")); }
public bool DeleteProduct(Productc product) { if (product == null) { return(false); } _unitOfWork.ProductcRepository.Delete(product); _unitOfWork.Save(); return(true); }
public ActionResult Edit([Bind(Include = "ProductcId,ProductName,ProductDescription,Model,UnitOfMeasure,UnitCost,UnitPrice,CategoryId")] Productc productc) { if (ModelState.IsValid) { if (_productService.EditProduct(productc)) { return(RedirectToAction("Index")); } } ViewBag.CategoryId = new SelectList(_categoryService.GetAllCategories(), "CategoryId", "CategoryName", productc.CategoryId); return(View(productc)); }
// GET: Productcs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Productc productc = _productService.FindById(id.Value); if (productc == null) { return(HttpNotFound()); } return(View(productc)); }
// GET: Productcs/Edit/5 public ActionResult Edit(string id) { if (id.IsEmpty()) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Productc productc = _productService.FindBy(x => x.ProductcId == id).SingleOrDefault(); if (productc == null) { return(HttpNotFound()); } ViewBag.CategoryId = new SelectList(_categoryService.GetAllCategories(), "CategoryId", "CategoryName", productc.CategoryId); return(View(productc)); }
// GET: Productcs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Productc productc = _productService.FindById(id.Value); if (productc == null) { return(HttpNotFound()); } ViewBag.CategoryId = new SelectList(_categoryService.GetAllCategories(), "CategoryId", "CategoryName", productc.CategoryId); return(View(productc)); }
public bool EditProduct(Productc product) { _unitOfWork.ProductcRepository.Edit(product); _unitOfWork.Save(); return(true); }
public bool AddProduct(Productc product) { _unitOfWork.ProductcRepository.Add(product); _unitOfWork.Save(); return(true); }